diff --git a/alib2data/src/XmlApi.hpp b/alib2data/src/XmlApi.hpp
index cf32f8ff9ce2701a29ddd20652e5449a90a11585..a4f7c9772d6f0c1ae1bf756944ea6fc118c3efd1 100644
--- a/alib2data/src/XmlApi.hpp
+++ b/alib2data/src/XmlApi.hpp
@@ -807,6 +807,10 @@ public:
 };
 
 class ToXMLComposers : public VisitableObjectBase::const_visitor_type {
+public:
+	ToXMLComposers() {}
+
+private:
 	void Visit(void*, const Void& voidObject) const;
 
 	void Visit(void*, const exception::AlibException& symbol) const;
diff --git a/alib2data/src/alphabet/BarSymbol.h b/alib2data/src/alphabet/BarSymbol.h
index 9b928307dae2842573306104e1fe00f90da6f454..11cae0120c7986c94bfc8de978daa32a3ce7653e 100644
--- a/alib2data/src/alphabet/BarSymbol.h
+++ b/alib2data/src/alphabet/BarSymbol.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<BarSymbol>();
+		return typeId(*this);
 	}
 
 	static BarSymbol BAR;
diff --git a/alib2data/src/alphabet/BlankSymbol.h b/alib2data/src/alphabet/BlankSymbol.h
index 818eee2cfb3fc63f29b2d9f0d79b6f2c071c6c08..f404638d5113d3ca96f4bdb67251c3f636b9dfb6 100644
--- a/alib2data/src/alphabet/BlankSymbol.h
+++ b/alib2data/src/alphabet/BlankSymbol.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<BlankSymbol>();
+		return typeId(*this);
 	}
 
 	static BlankSymbol BLANK;
diff --git a/alib2data/src/alphabet/BottomOfTheStackSymbol.h b/alib2data/src/alphabet/BottomOfTheStackSymbol.h
index 61c93e15d89acf48785caf76de3b2dd9e6dd58d7..187781882f5d86101110402bc1fad84a074e0f48 100644
--- a/alib2data/src/alphabet/BottomOfTheStackSymbol.h
+++ b/alib2data/src/alphabet/BottomOfTheStackSymbol.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<BottomOfTheStackSymbol>();
+		return typeId(*this);
 	}
 
 	static BottomOfTheStackSymbol BOTTOM_OF_THE_STACK;
diff --git a/alib2data/src/alphabet/EndSymbol.h b/alib2data/src/alphabet/EndSymbol.h
index e2edbd994f8681a9b6bfae0afec7cf96e6980819..c71c829f1ad8ed06b0a7c8eba00c25a8c94a6d92 100644
--- a/alib2data/src/alphabet/EndSymbol.h
+++ b/alib2data/src/alphabet/EndSymbol.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<EndSymbol>();
+		return typeId(*this);
 	}
 
 	static EndSymbol END;
diff --git a/alib2data/src/alphabet/LabeledSymbol.h b/alib2data/src/alphabet/LabeledSymbol.h
index 7a60729ea4b0e0b38f9496f9edb6f3ebb9310b2b..9a3b07c2bea5551e4d2df07b6985f60a76df024d 100644
--- a/alib2data/src/alphabet/LabeledSymbol.h
+++ b/alib2data/src/alphabet/LabeledSymbol.h
@@ -51,7 +51,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<LabeledSymbol>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/alphabet/RankedBarSymbol.h b/alib2data/src/alphabet/RankedBarSymbol.h
index 82a5360125a73fda66e42929a332090bca9e5b08..923fc5280b772210a1b612304218808ccaf94387 100644
--- a/alib2data/src/alphabet/RankedBarSymbol.h
+++ b/alib2data/src/alphabet/RankedBarSymbol.h
@@ -45,7 +45,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<RankedBarSymbol>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/alphabet/RankedSymbol.h b/alib2data/src/alphabet/RankedSymbol.h
index 96ab7921a6a2dd6018e22e4620be4ddeba2c89cd..93f91d38934b1ae48b1472207d26cb6bf68296d0 100644
--- a/alib2data/src/alphabet/RankedSymbol.h
+++ b/alib2data/src/alphabet/RankedSymbol.h
@@ -59,7 +59,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<RankedSymbol>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/alphabet/StartSymbol.h b/alib2data/src/alphabet/StartSymbol.h
index b22b5bd13ef29ec5a2273908a22e2544605b1bef..09a7d8e1cfd260075ccb76140fecddc1a8afd109 100644
--- a/alib2data/src/alphabet/StartSymbol.h
+++ b/alib2data/src/alphabet/StartSymbol.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<StartSymbol>();
+		return typeId(*this);
 	}
 
 	static StartSymbol START;
diff --git a/alib2data/src/alphabet/SubtreeWildcardSymbol.h b/alib2data/src/alphabet/SubtreeWildcardSymbol.h
index a8facf57eefe65b45e382d21f723a06634598c15..fb2094334e2f6833baa13cdee5fe31b4f8fdcc56 100644
--- a/alib2data/src/alphabet/SubtreeWildcardSymbol.h
+++ b/alib2data/src/alphabet/SubtreeWildcardSymbol.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<SubtreeWildcardSymbol>();
+		return typeId(*this);
 	}
 
 	static SubtreeWildcardSymbol SUBTREE_WILDCARD;
diff --git a/alib2data/src/alphabet/SymbolFromStringParser.h b/alib2data/src/alphabet/SymbolFromStringParser.h
index 32d9c65530c7f2a72b7249d1853072d56a8f1924..5d467712a16c7ad9b245d062994e2851b39f8eaa 100644
--- a/alib2data/src/alphabet/SymbolFromStringParser.h
+++ b/alib2data/src/alphabet/SymbolFromStringParser.h
@@ -22,12 +22,16 @@ struct stringApi;
 namespace alphabet {
 
 class SymbolFromStringParser {
+public:
+	SymbolFromStringParser() {};
+
+private:
 	SymbolFromStringLexer m_SymbolLexer;
 
 	Symbol parseSymbol(std::istream&, const std::set<FEATURES>& features) const;
 	Symbol parseSymbol(std::istream&) const;
 
-	template<typename T> friend class alib::stringApi;
+	template<typename T> friend struct alib::stringApi;
 };
 
 } /* namespace alphabet */
diff --git a/alib2data/src/alphabet/SymbolFromXMLParser.h b/alib2data/src/alphabet/SymbolFromXMLParser.h
index 71c2811736409e1bdd53b8a18c787774ae30abed..9a8ac474f040f2f7c70787459ce62325d45ebf7c 100644
--- a/alib2data/src/alphabet/SymbolFromXMLParser.h
+++ b/alib2data/src/alphabet/SymbolFromXMLParser.h
@@ -42,6 +42,10 @@ namespace alphabet {
  * Parser used to get String from XML parsed into list of tokens.
  */
 class SymbolFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	SymbolFromXMLParser() {}
+
+private:
 	Symbol parseSymbol(std::deque<sax::Token>& input) const;
 	Symbol parseSymbol(std::deque<sax::Token>& input, const std::set<FEATURES>& features) const;
 
@@ -58,7 +62,7 @@ class SymbolFromXMLParser : public sax::FromXMLParserHelper {
 	SymbolSetSymbol parseSymbolSetSymbol(std::deque<sax::Token>& input) const;
 	UniqueSymbol parseUniqueSymbol(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/alphabet/SymbolPairSymbol.h b/alib2data/src/alphabet/SymbolPairSymbol.h
index b44583e9a33735698370c4f40fa63f84a30277be..c0f2fa411b914044ce9ae50070dc192b42c87654 100644
--- a/alib2data/src/alphabet/SymbolPairSymbol.h
+++ b/alib2data/src/alphabet/SymbolPairSymbol.h
@@ -51,7 +51,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<SymbolPairSymbol>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/alphabet/SymbolSetSymbol.h b/alib2data/src/alphabet/SymbolSetSymbol.h
index bf13997816fb64c88f116e0bd5539c8c330d1c26..70286e2363bea6e09d736ce0bf792ebcfd406a39 100644
--- a/alib2data/src/alphabet/SymbolSetSymbol.h
+++ b/alib2data/src/alphabet/SymbolSetSymbol.h
@@ -51,7 +51,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<SymbolSetSymbol>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/alphabet/SymbolToStringComposer.h b/alib2data/src/alphabet/SymbolToStringComposer.h
index d4e652f6cf36ba2ed372db13183b47441ede5fe8..aee929cc76d19c4a5255a1b87f4942d0027138c9 100644
--- a/alib2data/src/alphabet/SymbolToStringComposer.h
+++ b/alib2data/src/alphabet/SymbolToStringComposer.h
@@ -17,6 +17,10 @@ namespace alphabet {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class SymbolToStringComposer : public VisitableSymbolBase::const_visitor_type {
+public:
+	SymbolToStringComposer() {}
+
+private:
 	void Visit(void*, const LabeledSymbol& symbol) const;
 	void Visit(void*, const BlankSymbol& symbol) const;
 	void Visit(void*, const BottomOfTheStackSymbol& symbol) const;
diff --git a/alib2data/src/alphabet/SymbolToXMLComposer.h b/alib2data/src/alphabet/SymbolToXMLComposer.h
index 6b9540369bf2834668e446612fe0956b88e79347..c896fc9ad58257410146ed3b707845f71d0f9a86 100644
--- a/alib2data/src/alphabet/SymbolToXMLComposer.h
+++ b/alib2data/src/alphabet/SymbolToXMLComposer.h
@@ -26,6 +26,10 @@ namespace alphabet {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class SymbolToXMLComposer {
+public:
+	SymbolToXMLComposer() {}
+
+private:
 	/**
 	 * Prints XML representation of UnknownAutomaton to the output stream.
 	 * @param automaton automaton to print
@@ -53,7 +57,7 @@ class SymbolToXMLComposer {
 	void compose(std::deque<sax::Token>& output, const SymbolSetSymbol& symbol) const;
 	void compose(std::deque<sax::Token>& output, const UniqueSymbol& symbol) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace alphabet */
diff --git a/alib2data/src/alphabet/UniqueSymbol.h b/alib2data/src/alphabet/UniqueSymbol.h
index 6c33af0d474d27c3a514a256c46e4c639fc29291..cde8d22c084d986ba0fde0eb4e665fec525bf4d2 100644
--- a/alib2data/src/alphabet/UniqueSymbol.h
+++ b/alib2data/src/alphabet/UniqueSymbol.h
@@ -55,7 +55,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<UniqueSymbol>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/AutomatonBase.h b/alib2data/src/automaton/AutomatonBase.h
index 0a36d3dcd3d2cbca3dbfe4f7b504125e61c19076..6ce99dfa0580fc64616c1575428ffb00bd138104 100644
--- a/alib2data/src/automaton/AutomatonBase.h
+++ b/alib2data/src/automaton/AutomatonBase.h
@@ -34,6 +34,8 @@ public:
 
 class VisitableConstFSMBase : public VisitableAutomatonBase::const_visitor_type {
 
+	using VisitableAutomatonBase::const_visitor_type::Visit;
+
 	void Visit(void*, const NFTA&) const {
 		throw exception::AlibException("Unsupported automaton type NFTA");
 	}
@@ -89,6 +91,8 @@ class VisitableConstFSMBase : public VisitableAutomatonBase::const_visitor_type
 
 class VisitableConstPDABase : public VisitableAutomatonBase::const_visitor_type {
 
+	using VisitableAutomatonBase::const_visitor_type::Visit;
+
 	void Visit(void*, const NFTA&) const {
 		throw exception::AlibException("Unsupported automaton type NFTA");
 	}
@@ -129,6 +133,8 @@ class VisitableConstPDABase : public VisitableAutomatonBase::const_visitor_type
 
 class VisitableConstNondeterministicAutomatonBase : public VisitableAutomatonBase::const_visitor_type {
 
+	using VisitableAutomatonBase::const_visitor_type::Visit;
+
 	void Visit(void*, const DFTA&) const {
 		throw exception::AlibException("Unsupported automaton type DFTA");
 	}
@@ -164,6 +170,8 @@ class VisitableConstNondeterministicAutomatonBase : public VisitableAutomatonBas
 
 class VisitableConstDeterministicAutomatonBase : public VisitableAutomatonBase::const_visitor_type {
 
+	using VisitableAutomatonBase::const_visitor_type::Visit;
+
 	void Visit(void*, const NFTA&) const {
 		throw exception::AlibException("Unsupported automaton type NFTA");
 	}
diff --git a/alib2data/src/automaton/AutomatonFromStringParser.h b/alib2data/src/automaton/AutomatonFromStringParser.h
index 640b1b7dee906130652f0bec9c84fd5603f5f867..a58e5a913b02bb534ebfa34bbb77faa00e1b97f0 100644
--- a/alib2data/src/automaton/AutomatonFromStringParser.h
+++ b/alib2data/src/automaton/AutomatonFromStringParser.h
@@ -28,6 +28,10 @@ struct stringApi;
 namespace automaton {
 
 class AutomatonFromStringParser {
+public:
+	AutomatonFromStringParser() {}
+
+private:
 	AutomatonFromStringLexer m_AutomatonLexer;
 
 	void initialFinalState(std::istream& input, bool& initial, bool& final) const;
@@ -45,7 +49,7 @@ class AutomatonFromStringParser {
 	MultiInitialStateNFA parseMultiInitialStateNFA(std::istream& input) const;
 	DFA parseDFA(std::istream& input) const;
 
-	template<typename T> friend class alib::stringApi;
+	template<typename T> friend struct alib::stringApi;
 };
 
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/AutomatonFromXMLParser.h b/alib2data/src/automaton/AutomatonFromXMLParser.h
index 21eb262110beb4156e7009768cb02dcb9b24fdbf..003f0ed40858c3806fac4c007c0d8ff0d1f6c058 100644
--- a/alib2data/src/automaton/AutomatonFromXMLParser.h
+++ b/alib2data/src/automaton/AutomatonFromXMLParser.h
@@ -49,6 +49,10 @@ namespace automaton {
  * Parser used to get general FSM or EpsilonNFA, NFA, DFA from XML parsed into deque of Tokens.
  */
 class AutomatonFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	AutomatonFromXMLParser() {}
+
+private:
 	std::set<State> parseStates(std::deque<sax::Token> &input) const;
 	State parseState(std::deque<sax::Token> &input) const;
 	std::set<alphabet::Symbol> parseInputAlphabet(std::deque<sax::Token> &input) const;
@@ -137,7 +141,7 @@ class AutomatonFromXMLParser : public sax::FromXMLParserHelper {
 	DFTA parseDFTA(std::deque<sax::Token>& input) const;
 	NFTA parseNFTA(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/automaton/AutomatonToStringComposer.h b/alib2data/src/automaton/AutomatonToStringComposer.h
index cadab745f0275e2fa5b1d8a365cc03972bd05fd0..ef2199529769b3e6f19b0591380cd996c418df87 100644
--- a/alib2data/src/automaton/AutomatonToStringComposer.h
+++ b/alib2data/src/automaton/AutomatonToStringComposer.h
@@ -18,6 +18,10 @@
 namespace automaton {
 
 class AutomatonToStringComposer : public VisitableAutomatonBase::const_visitor_type {
+public:
+	AutomatonToStringComposer() {}
+
+private:
 	void Visit(void*, const EpsilonNFA& automaton) const;
 	void Visit(void*, const MultiInitialStateNFA& automaton) const;
 	void Visit(void*, const NFA& automaton) const;
diff --git a/alib2data/src/automaton/AutomatonToXMLComposer.h b/alib2data/src/automaton/AutomatonToXMLComposer.h
index 03a15f46d27607a591f65731c9eddf214fa046f3..a3f94727dcf9cc4919711291e8facf0ecdc18e68 100644
--- a/alib2data/src/automaton/AutomatonToXMLComposer.h
+++ b/alib2data/src/automaton/AutomatonToXMLComposer.h
@@ -42,6 +42,10 @@ namespace automaton {
  * This class contains methods to print XML representation of automata to the output stream.
  */
 class AutomatonToXMLComposer {
+public:
+	AutomatonToXMLComposer() {}
+
+private:
 	void composeStates(std::deque<sax::Token>&, const std::set<State>& states) const;
 	void composeInputAlphabet(std::deque<sax::Token>&, const std::set<alphabet::Symbol>& symbols) const;
 	void composeCallInputAlphabet(std::deque<sax::Token>&, const std::set<alphabet::Symbol>& symbols) const;
@@ -127,7 +131,7 @@ class AutomatonToXMLComposer {
 
 	void compose(std::deque<sax::Token>& output, const State& state) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/FSM/CompactNFA.h b/alib2data/src/automaton/FSM/CompactNFA.h
index bd7560526125ef53897c0bec1c43634914f58f90..3a27e1b608a63b39440732406691a8d85ee94736 100644
--- a/alib2data/src/automaton/FSM/CompactNFA.h
+++ b/alib2data/src/automaton/FSM/CompactNFA.h
@@ -90,7 +90,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<CompactNFA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/FSM/DFA.h b/alib2data/src/automaton/FSM/DFA.h
index b50399469b8ddefcc45e687213c6010037a11611..c5aeac09d9f411c064a81a221805ba0331ab9818 100644
--- a/alib2data/src/automaton/FSM/DFA.h
+++ b/alib2data/src/automaton/FSM/DFA.h
@@ -91,7 +91,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<DFA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/FSM/EpsilonNFA.h b/alib2data/src/automaton/FSM/EpsilonNFA.h
index ff1c13f705f8a6b6af6ab1466a994d791e96bf68..4bac9902800f0ca021b82985995816699c499b0c 100644
--- a/alib2data/src/automaton/FSM/EpsilonNFA.h
+++ b/alib2data/src/automaton/FSM/EpsilonNFA.h
@@ -169,7 +169,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<EpsilonNFA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/FSM/ExtendedNFA.h b/alib2data/src/automaton/FSM/ExtendedNFA.h
index 4ef3b58657daf316f384f76390de9da9eac4cdbe..0d13ae8515eb09de2afa5e6f610a3c239c8d8639 100644
--- a/alib2data/src/automaton/FSM/ExtendedNFA.h
+++ b/alib2data/src/automaton/FSM/ExtendedNFA.h
@@ -92,7 +92,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<ExtendedNFA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/FSM/MultiInitialStateNFA.h b/alib2data/src/automaton/FSM/MultiInitialStateNFA.h
index ee1a836d2ae4f69e60000f5c2a4d684fab2fece5..ea4728148678e08cf3f8f90017652430a647f5b5 100644
--- a/alib2data/src/automaton/FSM/MultiInitialStateNFA.h
+++ b/alib2data/src/automaton/FSM/MultiInitialStateNFA.h
@@ -107,7 +107,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<MultiInitialStateNFA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/FSM/NFA.h b/alib2data/src/automaton/FSM/NFA.h
index 878b3ae0689b9119e77f7c9868bfd1573976d2fb..4b7c672e5fe665be8fb487748253804bd06587db 100644
--- a/alib2data/src/automaton/FSM/NFA.h
+++ b/alib2data/src/automaton/FSM/NFA.h
@@ -105,7 +105,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<NFA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/DPDA.h b/alib2data/src/automaton/PDA/DPDA.h
index c160cb48297e7fe27b589af9967f6a525dcc14a2..3c6d674e9ad0c83fd9ba34dc978e889ace1b70cc 100644
--- a/alib2data/src/automaton/PDA/DPDA.h
+++ b/alib2data/src/automaton/PDA/DPDA.h
@@ -102,7 +102,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<DPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/InputDrivenDPDA.h b/alib2data/src/automaton/PDA/InputDrivenDPDA.h
index b256d9312809a7b45716da034ec9c5a4ea3059f0..4e732890a7963d121d8dcd4f573e90ee24742757 100644
--- a/alib2data/src/automaton/PDA/InputDrivenDPDA.h
+++ b/alib2data/src/automaton/PDA/InputDrivenDPDA.h
@@ -104,7 +104,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<InputDrivenDPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/InputDrivenNPDA.h b/alib2data/src/automaton/PDA/InputDrivenNPDA.h
index a7ad529c2b8d36d599c7e7d16b4b40f2640fec65..4a0617f31ce36fb896965ce1042160ee4652ef10 100644
--- a/alib2data/src/automaton/PDA/InputDrivenNPDA.h
+++ b/alib2data/src/automaton/PDA/InputDrivenNPDA.h
@@ -103,7 +103,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<InputDrivenNPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/NPDA.h b/alib2data/src/automaton/PDA/NPDA.h
index e5ff3ec5e14a0020cdd4c918f7d85cd501d708dd..8f970a31bd0bd44c0f267bd9968aa35abee42eff 100644
--- a/alib2data/src/automaton/PDA/NPDA.h
+++ b/alib2data/src/automaton/PDA/NPDA.h
@@ -88,7 +88,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<NPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h
index 63aa3890733e91ecf5767309f16ef7c7c1bab029..99b582e569c0ab2dd951b7b2dc8861a8f2c20832 100644
--- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h
+++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h
@@ -128,7 +128,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<RealTimeHeightDeterministicDPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h
index e1c6a23886be390c6c78e85f22800ffed8438206..6d37544cf5b6886123c096b79330cd9a7e489b7a 100644
--- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h
+++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h
@@ -128,7 +128,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<RealTimeHeightDeterministicNPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/SinglePopDPDA.h b/alib2data/src/automaton/PDA/SinglePopDPDA.h
index b14fb3f948caaf459af3e4b04ce50518c6e922ee..270d2d790f64702d721fc22406c3b0a1d1f334d1 100644
--- a/alib2data/src/automaton/PDA/SinglePopDPDA.h
+++ b/alib2data/src/automaton/PDA/SinglePopDPDA.h
@@ -92,7 +92,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<SinglePopDPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/SinglePopNPDA.h b/alib2data/src/automaton/PDA/SinglePopNPDA.h
index 8284bf1c1457c877b22f8e63a1b4600b66807339..95a14e59fadaaf73aabcbecfd2f491760d2ed832 100644
--- a/alib2data/src/automaton/PDA/SinglePopNPDA.h
+++ b/alib2data/src/automaton/PDA/SinglePopNPDA.h
@@ -88,7 +88,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<SinglePopNPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h
index 516f5305a1219d449b1fe3e1c94693516cb7dd6d..8c19fa18eaff376c00c28501523253229199df16 100644
--- a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h
+++ b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h
@@ -114,7 +114,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<VisiblyPushdownDPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h
index 9b3cb34b67acf93486e4f6b00f3e8f8def842454..2e1a9c40dd4c6bec2c4f6437ad2e4d897c6f9dad 100644
--- a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h
+++ b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h
@@ -114,7 +114,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<VisiblyPushdownNPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/TA/DFTA.h b/alib2data/src/automaton/TA/DFTA.h
index aa1a656778ca7c465e66deb0e182bb352c04d52f..a200a08cb894c222454cfca1bc046b1e59207862 100644
--- a/alib2data/src/automaton/TA/DFTA.h
+++ b/alib2data/src/automaton/TA/DFTA.h
@@ -83,7 +83,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<DFTA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/TA/NFTA.h b/alib2data/src/automaton/TA/NFTA.h
index 95aa597b88018eb6cecd8b98bab0b0bde48c9e59..6920045f579fd385835c0d2c971943662806d5b6 100644
--- a/alib2data/src/automaton/TA/NFTA.h
+++ b/alib2data/src/automaton/TA/NFTA.h
@@ -95,7 +95,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<NFTA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/TM/OneTapeDTM.h b/alib2data/src/automaton/TM/OneTapeDTM.h
index b140ccb17dcca07ebaa86223f19cbcf31dd94435..83159f004b5320965bad831e385e9db311ec68d7 100644
--- a/alib2data/src/automaton/TM/OneTapeDTM.h
+++ b/alib2data/src/automaton/TM/OneTapeDTM.h
@@ -84,7 +84,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<OneTapeDTM>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/common/base.hpp b/alib2data/src/common/base.hpp
index 8fa2fcc3304f6a5381e8a557c028745938feb3c4..c8d6ac22647e9133ed651e63b6e898b6c72570a0 100644
--- a/alib2data/src/common/base.hpp
+++ b/alib2data/src/common/base.hpp
@@ -30,11 +30,16 @@ class base_helper;
 template<int ID, typename T>
 class base_helper<ID, T> : public base_base<ID + 1> {
 public:
+	//Note: Both versions are here because the static typeId with enable_if is not working in llvm
 	template<typename R, typename std::enable_if < std::is_same< R, T >::value >::type* = nullptr >
 	static int typeId() {
 		return ID;
 	}
 
+	int typeId(const T&) const {
+		return ID;
+	}
+
 	virtual int compare(const T &) const {
 		if(this->selfTypeId() < typeId<T>())
 			return -1;
@@ -51,11 +56,16 @@ public:
 	using base_helper<ID + 1, Types...>::compare;
 	using base_helper<ID + 1, Types...>::typeId;
 
+	//Note: Both versions are here because the static typeId with enable_if is not working in llvm
 	template<typename R, typename std::enable_if < std::is_same< R, T >::value >::type* = nullptr >
 	static int typeId() {
 		return ID;
 	}
 
+	int typeId(const T&) const {
+		return ID;
+	}
+
 	virtual int compare(const T &) const {
 		if(this->selfTypeId() < typeId<T>())
 			return -1;
diff --git a/alib2data/src/common/visitor.hpp b/alib2data/src/common/visitor.hpp
index 2dcba5923dc87237e5c472ef781fcdf8ee8e7938..9b27fab10a3b4759dcb8492bbc7f91261822f1cb 100644
--- a/alib2data/src/common/visitor.hpp
+++ b/alib2data/src/common/visitor.hpp
@@ -56,7 +56,7 @@ public:
 };
 
 template<typename... Types>
-class const_promoting_helper;
+struct const_promoting_helper;
 
 template<typename Tested, typename... Other>
 struct const_promoting_helper<Tested, Other...> {
@@ -100,7 +100,8 @@ struct const_promoting_helper<Tested, Other...> {
 	}
 };
 
-template<> struct const_promoting_helper<>  {
+template<>
+struct const_promoting_helper<>  {
 
 	template<class Desired, class Base, class TargetVisitor>
 	inline static bool tryPromote1(void*, const Desired&, const Base&, const TargetVisitor&) { return false; }
@@ -253,6 +254,8 @@ public:
 template<typename Derived, typename AcceptorBase, typename Base>
 class acceptor : public Base {
 public:
+	using Base::Accept;
+
 	virtual void Accept(void* userData, typename AcceptorBase::visitor_type& visitor) const {
 		visitor.Visit(userData, static_cast<const Derived&>(*this));
 	}
diff --git a/alib2data/src/container/ContainerFromXMLParser.hpp b/alib2data/src/container/ContainerFromXMLParser.hpp
index 11750428cb349a1efe2c01f4c0301cda6af4102b..7b51869a15eac9fcb7e38c76dae71000e88d0f1d 100644
--- a/alib2data/src/container/ContainerFromXMLParser.hpp
+++ b/alib2data/src/container/ContainerFromXMLParser.hpp
@@ -34,6 +34,10 @@ namespace container {
  * Parser used to get general FSM or EpsilonNFA, NFA, DFA from XML parsed into list of Tokens.
  */
 class ContainerFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	ContainerFromXMLParser() {}
+
+private:
 	Container parseContainer(std::deque<sax::Token>& input) const;
 	Container parseContainer(std::deque<sax::Token>& input, const std::set<FEATURES>& features) const;
 
@@ -60,7 +64,7 @@ class ContainerFromXMLParser : public sax::FromXMLParserHelper {
 	template<typename ... Ts>
 	std::variant<Ts...> parseVariant(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 
 public:
 	bool first(const std::deque<sax::Token>& input) const;
diff --git a/alib2data/src/container/ContainerToXMLComposer.hpp b/alib2data/src/container/ContainerToXMLComposer.hpp
index e643f6626463852c5a4461d4a3d7fbda621bccbb..d130bcb88f5db49e7499c1abda65fdd773aa012e 100644
--- a/alib2data/src/container/ContainerToXMLComposer.hpp
+++ b/alib2data/src/container/ContainerToXMLComposer.hpp
@@ -30,6 +30,10 @@ namespace container {
  * This class contains methods to print XML representation of automata to the output stream.
  */
 class ContainerToXMLComposer {
+public:
+	ContainerToXMLComposer() {}
+
+private:
 	/**
 	 * Prints XML representation of UnknownAutomaton to the output stream.
 	 * @param automaton automaton to print
@@ -67,7 +71,7 @@ class ContainerToXMLComposer {
 	template<typename ... Ts>
 	void compose(std::deque<sax::Token>& output, const std::variant<Ts...>& container) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace container */
diff --git a/alib2data/src/container/ObjectsMap.h b/alib2data/src/container/ObjectsMap.h
index c4d7aa4ca20de4e2a3817a792d7ef9ead5d0ec02..d53a1554f3e90741c4685f54769851200ea07ffc 100644
--- a/alib2data/src/container/ObjectsMap.h
+++ b/alib2data/src/container/ObjectsMap.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<ObjectsMap>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/container/ObjectsPair.h b/alib2data/src/container/ObjectsPair.h
index f3830f13c308c3f45d98878cfe36e10b47d72f6e..c10c7e5381e2a383b04f9e471ee58aad3d097792 100644
--- a/alib2data/src/container/ObjectsPair.h
+++ b/alib2data/src/container/ObjectsPair.h
@@ -39,7 +39,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<ObjectsPair>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/container/ObjectsSet.h b/alib2data/src/container/ObjectsSet.h
index 16747c020c98872f4df8a7187b387f483333a660..ce738a70b14680d6facf08f2602a975d7789c741 100644
--- a/alib2data/src/container/ObjectsSet.h
+++ b/alib2data/src/container/ObjectsSet.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<ObjectsSet>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/container/ObjectsVector.h b/alib2data/src/container/ObjectsVector.h
index 1c88f62645bf11cfe4c266ad6e6696bab95c174a..20f23e544577be6ac51795773fb2f1e00cea27ed 100644
--- a/alib2data/src/container/ObjectsVector.h
+++ b/alib2data/src/container/ObjectsVector.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<ObjectsVector>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/exception/AlibException.h b/alib2data/src/exception/AlibException.h
index 7b3007ac43bb8a7d05764868c8670eede1ab1c37..1b22e0cfaf938fbd4e10d3dee5349f132f3aaf9b 100644
--- a/alib2data/src/exception/AlibException.h
+++ b/alib2data/src/exception/AlibException.h
@@ -64,7 +64,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<AlibException>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/exception/ExceptionFromXMLParser.h b/alib2data/src/exception/ExceptionFromXMLParser.h
index c945181d83864abb376bb051816f09fa2addcc17..4c5ad16d9cdd780b6d64062aa99e8abbb6e43fb7 100644
--- a/alib2data/src/exception/ExceptionFromXMLParser.h
+++ b/alib2data/src/exception/ExceptionFromXMLParser.h
@@ -27,13 +27,17 @@ namespace exception {
  * Parser used to get String from XML parsed into list of tokens.
  */
 class ExceptionFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	ExceptionFromXMLParser() {}
+
+private:
 	AlibException parseException(std::deque<sax::Token>& input) const;
 	AlibException parseException(std::deque<sax::Token>& input, const std::set<FEATURES>& features) const;
 
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace exception */
diff --git a/alib2data/src/exception/ExceptionToXMLComposer.h b/alib2data/src/exception/ExceptionToXMLComposer.h
index e669286ee75a58d2763f48201b20703fd49a45f1..a8529ab0ff1949dfc5089e0da024d7aa8c533742 100644
--- a/alib2data/src/exception/ExceptionToXMLComposer.h
+++ b/alib2data/src/exception/ExceptionToXMLComposer.h
@@ -25,6 +25,10 @@ namespace exception {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class ExceptionToXMLComposer {
+public:
+	ExceptionToXMLComposer() {}
+
+private:
 	/**
 	 * Prints XML representation of AlibException to the output stream.
 	 * @param string Exception to print
@@ -32,7 +36,7 @@ class ExceptionToXMLComposer {
 	 */
 	void compose(std::deque<sax::Token>& out, const AlibException& exception) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace exception */
diff --git a/alib2data/src/grammar/ContextFree/CFG.h b/alib2data/src/grammar/ContextFree/CFG.h
index a974c1b2f99634fd6c545bbb29103a9c905a7bd3..61816d597df493413d0fba77b7c7ea41ed686ce3 100644
--- a/alib2data/src/grammar/ContextFree/CFG.h
+++ b/alib2data/src/grammar/ContextFree/CFG.h
@@ -58,7 +58,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<CFG>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextFree/CNF.h b/alib2data/src/grammar/ContextFree/CNF.h
index 5b30c24170ba68c41f4ea7d0bbb81225f02576df..9c68f2bdf0897ac29e338c95cf9f9b5d3f97a362 100644
--- a/alib2data/src/grammar/ContextFree/CNF.h
+++ b/alib2data/src/grammar/ContextFree/CNF.h
@@ -67,7 +67,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<CNF>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h
index 9fafdb50e2e910c72da5f1bc16d506fe162f33ee..901f307ef2e059146fc03a06c71c363e101fdbf1 100644
--- a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h
+++ b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h
@@ -62,7 +62,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<EpsilonFreeCFG>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextFree/GNF.h b/alib2data/src/grammar/ContextFree/GNF.h
index 56d14b47f2f5c5f6856ff4309af8674646e78b09..3ecaf3607ed14b7070708f5188b290d1a959887d 100644
--- a/alib2data/src/grammar/ContextFree/GNF.h
+++ b/alib2data/src/grammar/ContextFree/GNF.h
@@ -62,7 +62,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<GNF>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextFree/LG.h b/alib2data/src/grammar/ContextFree/LG.h
index 07299fa74736880aa489307ee548042a58de1af7..7b95823e1e58b6765e2f78c5beca9b630e82a501 100644
--- a/alib2data/src/grammar/ContextFree/LG.h
+++ b/alib2data/src/grammar/ContextFree/LG.h
@@ -63,7 +63,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<LG>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextSensitive/CSG.h b/alib2data/src/grammar/ContextSensitive/CSG.h
index 733b96d7ceea06d673f20972d822565c24d77d55..4df0472e4e2deb71f936d2bf45d66d782eaa98c4 100644
--- a/alib2data/src/grammar/ContextSensitive/CSG.h
+++ b/alib2data/src/grammar/ContextSensitive/CSG.h
@@ -55,7 +55,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<CSG>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h
index c51da8e2cd5a42535705962ddff9b6484b80153a..d1571896b4b6acaedf28f3debe76cd8386d65f39 100644
--- a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h
+++ b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h
@@ -55,7 +55,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<NonContractingGrammar>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/GrammarBase.h b/alib2data/src/grammar/GrammarBase.h
index cc08c8f71f33acf0e1155b2cf593f55eef99196b..74018b7af972ffc292ba96f221d40b5783f5f811 100644
--- a/alib2data/src/grammar/GrammarBase.h
+++ b/alib2data/src/grammar/GrammarBase.h
@@ -34,6 +34,8 @@ public:
 
 class VisitableConstRGBase : public VisitableGrammarBase::const_visitor_type {
 
+	using VisitableGrammarBase::const_visitor_type::Visit;
+
 	void Visit(void*, const grammar::ContextPreservingUnrestrictedGrammar&) const
 	{
 	    throw exception::AlibException("Unsupported grammar type ContextPreservingUnrestrictedGrammar");
diff --git a/alib2data/src/grammar/GrammarFromStringParser.h b/alib2data/src/grammar/GrammarFromStringParser.h
index 5cbc7360734db1c5c634351f8fa2cc3d3b145b8a..dc070dfa3b10bfcb4488f82308003fdbd538a050 100644
--- a/alib2data/src/grammar/GrammarFromStringParser.h
+++ b/alib2data/src/grammar/GrammarFromStringParser.h
@@ -26,6 +26,10 @@ struct stringApi;
 namespace grammar {
 
 class GrammarFromStringParser {
+public:
+	GrammarFromStringParser() {}
+
+private:
 	GrammarFromStringLexer m_GrammarLexer;
 
 	std::set<alphabet::Symbol> parseSet(std::istream& input) const;
@@ -58,7 +62,7 @@ class GrammarFromStringParser {
 	ContextPreservingUnrestrictedGrammar parseContextPreservingUnrestrictedGrammar(std::istream& input) const;
 	UnrestrictedGrammar parseUnrestrictedGrammar(std::istream& input) const;
 
-	template<typename T> friend class alib::stringApi;
+	template<typename T> friend struct alib::stringApi;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/GrammarFromXMLParser.h b/alib2data/src/grammar/GrammarFromXMLParser.h
index d999109163fe4ccfad76fa2ed7c7d13b1909f788..f65ec3b3afd5ae5c7a26bdd9e4bc1b8b3c191205 100644
--- a/alib2data/src/grammar/GrammarFromXMLParser.h
+++ b/alib2data/src/grammar/GrammarFromXMLParser.h
@@ -43,6 +43,10 @@ namespace grammar {
  * Parser used to get general FSM or EpsilonNFA, NFA, DFA from XML parsed into list of Tokens.
  */
 class GrammarFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	GrammarFromXMLParser() {}
+
+private:
 	std::set<alphabet::Symbol> parseNonterminalAlphabet(std::deque<sax::Token> &input) const;
 	std::set<alphabet::Symbol> parseTerminalAlphabet(std::deque<sax::Token> &input) const;
 	alphabet::Symbol parseInitialSymbol(std::deque<sax::Token> &input) const;
@@ -90,7 +94,7 @@ class GrammarFromXMLParser : public sax::FromXMLParserHelper {
 	LeftRG parseLeftRG(std::deque<sax::Token>& input) const;
 	LeftLG parseLeftLG(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/grammar/GrammarToStringComposer.h b/alib2data/src/grammar/GrammarToStringComposer.h
index 28a74f9626de8771c2c0c199f548eb090070c00f..5c092076d4d2bbae1b78d962286054fa6a916c26 100644
--- a/alib2data/src/grammar/GrammarToStringComposer.h
+++ b/alib2data/src/grammar/GrammarToStringComposer.h
@@ -11,6 +11,10 @@
 namespace grammar {
 
 class GrammarToStringComposer : public VisitableGrammarBase::const_visitor_type {
+public:
+	GrammarToStringComposer() {}
+
+private:
 	void Visit(void*, const LeftLG& grammar) const;
 	void Visit(void*, const LeftRG& grammar) const;
 	void Visit(void*, const RightLG& grammar) const;
diff --git a/alib2data/src/grammar/GrammarToXMLComposer.h b/alib2data/src/grammar/GrammarToXMLComposer.h
index 02ed0798a81ec427a43ac37539538e380ee08720..6481191f08249798ac97dbd30fd3193b2a9647e2 100644
--- a/alib2data/src/grammar/GrammarToXMLComposer.h
+++ b/alib2data/src/grammar/GrammarToXMLComposer.h
@@ -39,6 +39,10 @@ namespace grammar {
  * This class contains methods to print XML representation of automata to the output stream.
  */
 class GrammarToXMLComposer {
+public:
+	GrammarToXMLComposer() {}
+
+private:
 	void composeNonterminalAlphabet(std::deque<sax::Token>& out, const std::set<alphabet::Symbol>& symbols) const;
 	void composeTerminalAlphabet(std::deque<sax::Token>& out, const std::set<alphabet::Symbol>& symbols) const;
 	void composeInitialSymbol(std::deque<sax::Token>& out, const alphabet::Symbol& symbol) const;
@@ -92,7 +96,7 @@ class GrammarToXMLComposer {
 	void compose(std::deque<sax::Token>& out, const ContextPreservingUnrestrictedGrammar& grammar) const;
 	void compose(std::deque<sax::Token>& out, const UnrestrictedGrammar& grammar) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/Regular/LeftLG.h b/alib2data/src/grammar/Regular/LeftLG.h
index 5cbc3a41f32c3484f87ac055a4e0d249e06b9c58..40a7b1d8e2924cba9d9cc983cee64ea1f283e820 100644
--- a/alib2data/src/grammar/Regular/LeftLG.h
+++ b/alib2data/src/grammar/Regular/LeftLG.h
@@ -62,7 +62,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<LeftLG>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/Regular/LeftRG.h b/alib2data/src/grammar/Regular/LeftRG.h
index f036487d476ea161c138df260240fbc7d7839af4..6c186196cdb1ad35d24c5e585b21258cc234e6ea 100644
--- a/alib2data/src/grammar/Regular/LeftRG.h
+++ b/alib2data/src/grammar/Regular/LeftRG.h
@@ -149,7 +149,7 @@ public:
 	 * @copydoc alib::base_base::selfTypeId
 	 */
 	virtual int selfTypeId() const {
-		return typeId<LeftRG>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/Regular/RightLG.h b/alib2data/src/grammar/Regular/RightLG.h
index 69f53a1ec34ea673447c58a058b1bdc34afb3b4c..fda7269eed6251e66875d27744e19d1dc63097f1 100644
--- a/alib2data/src/grammar/Regular/RightLG.h
+++ b/alib2data/src/grammar/Regular/RightLG.h
@@ -62,7 +62,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<RightLG>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/Regular/RightRG.h b/alib2data/src/grammar/Regular/RightRG.h
index ff32ca9644ed0c8d5ad3afb48b08519dde225484..65c8a487bfcf3cbf57598e4166456a2140b616b2 100644
--- a/alib2data/src/grammar/Regular/RightRG.h
+++ b/alib2data/src/grammar/Regular/RightRG.h
@@ -82,7 +82,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<RightRG>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h
index 7cd0666b55e2569a64b57cdf89b02a29600b33b4..54c6ac574cb778edcfd596114a43dfde36f7af33 100644
--- a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h
+++ b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h
@@ -51,7 +51,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<ContextPreservingUnrestrictedGrammar>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h
index e2fe2d64cd84ae886018fac3155413746204e328..36b7393c8be0b5c8899cfb257c18cba36a87d963 100644
--- a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h
+++ b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h
@@ -51,7 +51,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnrestrictedGrammar>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/graph/GraphFromStringParser.h b/alib2data/src/graph/GraphFromStringParser.h
index 379ac016f89adfa3b36f7987e184100b15641f4d..1e31e09d14b31fdd65fd569470edff4b0f6913f4 100644
--- a/alib2data/src/graph/GraphFromStringParser.h
+++ b/alib2data/src/graph/GraphFromStringParser.h
@@ -21,6 +21,9 @@ namespace graph {
 
 class GraphFromStringParser
 {
+public:
+	GraphFromStringParser() {}
+
 private:
 	Graph parseGraph(std::istream &input) const;
 	DirectedGraph parseDirectedGraph(std::istream &input) const;
@@ -45,7 +48,7 @@ private:
 
 	GraphFromStringLexer lexer;
 
-	template<typename T> friend class alib::stringApi;
+	template<typename T> friend struct alib::stringApi;
 };
 
 } // namespace graph
diff --git a/alib2data/src/graph/GraphFromXMLParser.h b/alib2data/src/graph/GraphFromXMLParser.h
index 44af1e37ac7373955f0f8bc9036280a887152fee..32077493dcafd8c495740f6e452149cec8ede320 100644
--- a/alib2data/src/graph/GraphFromXMLParser.h
+++ b/alib2data/src/graph/GraphFromXMLParser.h
@@ -22,6 +22,7 @@ namespace graph {
 class GraphFromXMLParser : public sax::FromXMLParserHelper
 {
 public:
+	GraphFromXMLParser() {}
 	bool first(const std::deque<sax::Token> &input) const;
 
 private:
@@ -45,7 +46,7 @@ private:
 	void parseDirectedEdgeValues(std::deque<sax::Token> &input, DirectedGraph &graph) const;
 	void parseUndirectedEdgeValues(std::deque<sax::Token> &input, UndirectedGraph &graph) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } // namespace graph
diff --git a/alib2data/src/graph/GraphToStringComposer.h b/alib2data/src/graph/GraphToStringComposer.h
index 052bf35671b94724c7bc3a46d3553f16df95cde6..7db1ec0cf4ce8112c3112e31038020c459f9221e 100644
--- a/alib2data/src/graph/GraphToStringComposer.h
+++ b/alib2data/src/graph/GraphToStringComposer.h
@@ -16,6 +16,8 @@ namespace graph {
 class GraphToStringComposer : public VisitableGraphBase::const_visitor_type, GraphElement::const_visitor_type
 {
 public:
+	GraphToStringComposer() {}
+
 	void compose(std::ostream &out, const Graph &graph) const;
 
 private:
diff --git a/alib2data/src/graph/GraphToXMLComposer.h b/alib2data/src/graph/GraphToXMLComposer.h
index ef876f36688eae35ecbdb5afeca6cc50e0280819..cae8a1799973b4774d7934706ccd80715c390214 100644
--- a/alib2data/src/graph/GraphToXMLComposer.h
+++ b/alib2data/src/graph/GraphToXMLComposer.h
@@ -22,6 +22,9 @@ namespace graph {
 // This class contains methods to print XML representation of graph to the output stream.
 class GraphToXMLComposer : public GraphElement::const_visitor_type
 {
+public:
+	GraphToXMLComposer() {}
+
 private:
 	void Visit(void *data, const Node &node) const;
 	void Visit(void *data, const DirectedEdge &edge) const;
@@ -43,7 +46,7 @@ private:
 	template<typename T>
 	void composeEdgeValues(std::deque<sax::Token> &out, const T &graph) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } // namespace graph
diff --git a/alib2data/src/graph/directed/DirectedEdge.h b/alib2data/src/graph/directed/DirectedEdge.h
index fecb0a71f77032e0969ffe17eae0ea7886c9e86d..6700f6f0407496ea8402632fe2aa58357f52a4d8 100644
--- a/alib2data/src/graph/directed/DirectedEdge.h
+++ b/alib2data/src/graph/directed/DirectedEdge.h
@@ -47,7 +47,7 @@ public:
 
 	int selfTypeId() const override
 	{
-		return typeId<DirectedEdge>();
+		return typeId(*this);
 	}
 
 	friend std::ostream &operator<<(std::ostream &out, const DirectedEdge &node);
diff --git a/alib2data/src/graph/directed/DirectedGraph.h b/alib2data/src/graph/directed/DirectedGraph.h
index e1c309ec224a4dd6fd5ccf308a0866201662f5da..3cf5b7b0f730a228e7d0a4e4480b66a1577342e3 100644
--- a/alib2data/src/graph/directed/DirectedGraph.h
+++ b/alib2data/src/graph/directed/DirectedGraph.h
@@ -69,7 +69,7 @@ public:
 
 	int selfTypeId() const override
 	{
-		return typeId<DirectedGraph>();
+		return typeId(*this);
 	}
 
 private:
diff --git a/alib2data/src/graph/undirected/UndirectedEdge.h b/alib2data/src/graph/undirected/UndirectedEdge.h
index e0757e632774bef50b817977f6e2f2b646417911..2b5a8bf92568edd5b93ed04f7d95fbc7da960eb8 100644
--- a/alib2data/src/graph/undirected/UndirectedEdge.h
+++ b/alib2data/src/graph/undirected/UndirectedEdge.h
@@ -47,7 +47,7 @@ public:
 
 	int selfTypeId() const override
 	{
-		return typeId<UndirectedEdge>();
+		return typeId(*this);
 	}
 
 	friend std::ostream &operator<<(std::ostream &out, const UndirectedEdge &node);
diff --git a/alib2data/src/graph/undirected/UndirectedGraph.h b/alib2data/src/graph/undirected/UndirectedGraph.h
index cff66b121b570ad6f9fac872bfc5fdd0bd90bc2d..26e349bdd37edad6783cf73fb49edb17a503b83e 100644
--- a/alib2data/src/graph/undirected/UndirectedGraph.h
+++ b/alib2data/src/graph/undirected/UndirectedGraph.h
@@ -69,7 +69,7 @@ public:
 
 	int selfTypeId() const override
 	{
-		return typeId<UndirectedGraph>();
+		return typeId(*this);
 	}
 
 private:
diff --git a/alib2data/src/label/HexavigesimalLabel.h b/alib2data/src/label/HexavigesimalLabel.h
index eca737c5ddacc9a9bcd6baec963fa4d747a1cbc9..f01784ab8683992caeddeab7f9159926f11b418d 100644
--- a/alib2data/src/label/HexavigesimalLabel.h
+++ b/alib2data/src/label/HexavigesimalLabel.h
@@ -49,7 +49,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<HexavigesimalLabel>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/label/LabelFromStringParser.h b/alib2data/src/label/LabelFromStringParser.h
index 01b676ac1f1e673ec3fbcb355f94de5778b9fe5f..17dfb335d2eec7070d132fa595c525149b6d2ea0 100644
--- a/alib2data/src/label/LabelFromStringParser.h
+++ b/alib2data/src/label/LabelFromStringParser.h
@@ -24,12 +24,16 @@ struct stringApi;
 namespace label {
 
 class LabelFromStringParser {
+public:
+	LabelFromStringParser() {}
+
+private:
 	LabelFromStringLexer m_Lexer;
 
 	Label parseLabel(std::istream&, const std::set<FEATURES>&) const;
 	Label parseLabel(std::istream&) const;
 
-	template<typename T> friend class alib::stringApi;
+	template<typename T> friend struct alib::stringApi;
 };
 
 } /* namespace label */
diff --git a/alib2data/src/label/LabelFromXMLParser.h b/alib2data/src/label/LabelFromXMLParser.h
index d7be430e0a2bf5714d0c90a36201451fbc5b3da7..8b3fba646e956ac17be9ffb4b6c48202b1815f8f 100644
--- a/alib2data/src/label/LabelFromXMLParser.h
+++ b/alib2data/src/label/LabelFromXMLParser.h
@@ -34,6 +34,10 @@ namespace label {
  * Parser used to transform sequence of xml tokens to internal representation of Label.
  */
 class LabelFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	LabelFromXMLParser() {}
+
+private:
 	Label parseLabel(std::deque<sax::Token>& input, const std::set<FEATURES>&) const;
 	Label parseLabel(std::deque<sax::Token>& input) const;
 
@@ -44,7 +48,7 @@ class LabelFromXMLParser : public sax::FromXMLParserHelper {
 	LabelPairLabel parseLabelPairLabel(std::deque<sax::Token>& input) const;
 	UniqueLabel parseUniqueLabel(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/label/LabelPairLabel.h b/alib2data/src/label/LabelPairLabel.h
index ca517cb5c38aa1e50718d5bf3b10bf9097091222..27ecbf9fa184f5bc7f7382e5baeecc68e3ac5226 100644
--- a/alib2data/src/label/LabelPairLabel.h
+++ b/alib2data/src/label/LabelPairLabel.h
@@ -51,7 +51,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<LabelPairLabel>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/label/LabelSetLabel.h b/alib2data/src/label/LabelSetLabel.h
index 0976572171055e6cab1440e7e8b585811d905bfd..875140896528a1306d91d474c30a281260ef3c74 100644
--- a/alib2data/src/label/LabelSetLabel.h
+++ b/alib2data/src/label/LabelSetLabel.h
@@ -51,7 +51,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<LabelSetLabel>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/label/LabelToStringComposer.h b/alib2data/src/label/LabelToStringComposer.h
index 84489777506188883f44f8875822203d6ae88665..7e7227182c5c2f5d543bb81db1e58221d96d8dbe 100644
--- a/alib2data/src/label/LabelToStringComposer.h
+++ b/alib2data/src/label/LabelToStringComposer.h
@@ -17,6 +17,10 @@ namespace label {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class LabelToStringComposer : public VisitableLabelBase::const_visitor_type {
+public:
+	LabelToStringComposer() {}
+
+private:
 	void Visit(void*, const PrimitiveLabel& label) const;
 	void Visit(void*, const HexavigesimalLabel& label) const;
 	void Visit(void*, const ObjectLabel& label) const;
diff --git a/alib2data/src/label/LabelToXMLComposer.h b/alib2data/src/label/LabelToXMLComposer.h
index 59082154ee6d0130b8940a3af1c14f726721a979..d3cc0d1ff74803f7656a71a3a0f1d39b3ac8b04d 100644
--- a/alib2data/src/label/LabelToXMLComposer.h
+++ b/alib2data/src/label/LabelToXMLComposer.h
@@ -25,6 +25,10 @@ namespace label {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class LabelToXMLComposer {
+public:
+	LabelToXMLComposer() {}
+
+private:
 	/**
 	 * Prints XML representation of String to the output stream.
 	 * @param string String to print
@@ -46,7 +50,7 @@ class LabelToXMLComposer {
 	void compose(std::deque<sax::Token>& out, const LabelPairLabel& label) const;
 	void compose(std::deque<sax::Token>& out, const UniqueLabel& label) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace label */
diff --git a/alib2data/src/label/ObjectLabel.h b/alib2data/src/label/ObjectLabel.h
index e467f30e9517205641e6a114f11cf18374c90669..f4f74013b3f280768c123e0ae4b12f15d308485b 100644
--- a/alib2data/src/label/ObjectLabel.h
+++ b/alib2data/src/label/ObjectLabel.h
@@ -49,7 +49,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<ObjectLabel>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/label/PrimitiveLabel.h b/alib2data/src/label/PrimitiveLabel.h
index 3cff7b163760b64c7d2de2c8cb62feb84cf0b0f8..1bc84f499e441d65edc0c0606194426d2b8a89de 100644
--- a/alib2data/src/label/PrimitiveLabel.h
+++ b/alib2data/src/label/PrimitiveLabel.h
@@ -49,7 +49,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<PrimitiveLabel>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/label/UniqueLabel.h b/alib2data/src/label/UniqueLabel.h
index 4073a89912e0985c146a60e1a696d92fb1ecd025..d8880d4920c3a02e5447bb14607a6adb06302d6f 100644
--- a/alib2data/src/label/UniqueLabel.h
+++ b/alib2data/src/label/UniqueLabel.h
@@ -55,7 +55,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<UniqueLabel>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/object/ObjectFromXMLParser.h b/alib2data/src/object/ObjectFromXMLParser.h
index cdcf31d6dd969cab6ec2e0e87bc80a6bd849ac21..c50f304615a8be60cc85ee6252469113141d11a9 100644
--- a/alib2data/src/object/ObjectFromXMLParser.h
+++ b/alib2data/src/object/ObjectFromXMLParser.h
@@ -27,10 +27,14 @@ namespace alib {
  * Parser used to get String from XML parsed into list of tokens.
  */
 class ObjectFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	ObjectFromXMLParser() {}
+
+private:
 	Object parseObject(std::deque<sax::Token>& input) const;
 	Void parseVoid(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/object/ObjectToXMLComposer.h b/alib2data/src/object/ObjectToXMLComposer.h
index 7e5ffc85d4b3004662c7bb287aafd604a5171ddf..9966984cb549b2598f646320b20af89231c69bd2 100644
--- a/alib2data/src/object/ObjectToXMLComposer.h
+++ b/alib2data/src/object/ObjectToXMLComposer.h
@@ -27,6 +27,10 @@ namespace alib {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class ObjectToXMLComposer {
+public:
+	ObjectToXMLComposer() {}
+
+private:
 	/**
 	 * Prints XML representation of UnknownAutomaton to the output stream.
 	 * @param automaton automaton to print
@@ -48,7 +52,7 @@ class ObjectToXMLComposer {
 	 */
 	void compose(std::deque<sax::Token>& out, const Void& voidObject) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace alib */
diff --git a/alib2data/src/object/Void.h b/alib2data/src/object/Void.h
index cd400bed8f09e1a9b4c6ae0eeb1a768587c6f48a..001cf44585e8e07b3854771016053d57880e942e 100644
--- a/alib2data/src/object/Void.h
+++ b/alib2data/src/object/Void.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<Void>();
+		return typeId(*this);
 	}
 
 	static Void VOID;
diff --git a/alib2data/src/primitive/Bool.h b/alib2data/src/primitive/Bool.h
index 9561862a090326872ffd7891d418a02805a1da6c..7ca38b3b3f45b17b79cdf5d37d3f1cc50d0bebc7 100644
--- a/alib2data/src/primitive/Bool.h
+++ b/alib2data/src/primitive/Bool.h
@@ -48,7 +48,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<Bool>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/primitive/Character.h b/alib2data/src/primitive/Character.h
index 13aba2a13dc3972f10ea492a10425e658f6ac3bd..328dd2f28a83194a87e2a8f2bba024d7769247ff 100644
--- a/alib2data/src/primitive/Character.h
+++ b/alib2data/src/primitive/Character.h
@@ -49,7 +49,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<Character>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/primitive/Integer.h b/alib2data/src/primitive/Integer.h
index 47c01dfdf18c2cec0489571a933fa6131605563d..4ac4b7245fd0f1c1d54df1840a148d5bce9ef473 100644
--- a/alib2data/src/primitive/Integer.h
+++ b/alib2data/src/primitive/Integer.h
@@ -48,7 +48,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<Integer>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/primitive/PrimitiveFromStringParser.h b/alib2data/src/primitive/PrimitiveFromStringParser.h
index f81c4b1cbe49dadc6554eeb116545f99d852c6f9..117d913970d87cc507e1e2196a79a4b6774c3cb3 100644
--- a/alib2data/src/primitive/PrimitiveFromStringParser.h
+++ b/alib2data/src/primitive/PrimitiveFromStringParser.h
@@ -24,12 +24,16 @@ struct stringApi;
 namespace primitive {
 
 class PrimitiveFromStringParser {
+public:
+	PrimitiveFromStringParser() {}
+
+private:
 	PrimitiveFromStringLexer m_Lexer;
 
 	Primitive parsePrimitive(std::istream&, const std::set<FEATURES>&) const;
 	Primitive parsePrimitive(std::istream&) const;
 
-	template<typename T> friend class alib::stringApi;
+	template<typename T> friend struct alib::stringApi;
 };
 
 } /* namespace primitive */
diff --git a/alib2data/src/primitive/PrimitiveFromXMLParser.h b/alib2data/src/primitive/PrimitiveFromXMLParser.h
index 92575ceec2a62aa595a4d2a11784cd24c0642d24..4a0056cc2130364c4124f983a2607dad7722f751 100644
--- a/alib2data/src/primitive/PrimitiveFromXMLParser.h
+++ b/alib2data/src/primitive/PrimitiveFromXMLParser.h
@@ -32,6 +32,10 @@ namespace primitive {
  * Parser used to transform sequence of xml tokens to internal representation of Primitive.
  */
 class PrimitiveFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	PrimitiveFromXMLParser() {}
+
+private:
 	Primitive parsePrimitive(std::deque<sax::Token>& input, const std::set<FEATURES>&) const;
 	Primitive parsePrimitive(std::deque<sax::Token>& input) const;
 
@@ -47,7 +51,7 @@ class PrimitiveFromXMLParser : public sax::FromXMLParserHelper {
 	unsigned parseUnsignedRaw(std::deque<sax::Token>& input) const;
 	bool parseBoolRaw(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/primitive/PrimitiveToStringComposer.h b/alib2data/src/primitive/PrimitiveToStringComposer.h
index b3a08bf8948c7a91ec5809c3d74d5d0985210b1c..af9947fe8c6e52d8d72cb4825f334042ec7640c4 100644
--- a/alib2data/src/primitive/PrimitiveToStringComposer.h
+++ b/alib2data/src/primitive/PrimitiveToStringComposer.h
@@ -17,6 +17,10 @@ namespace primitive {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class PrimitiveToStringComposer : public VisitablePrimitiveBase::const_visitor_type {
+public:
+	PrimitiveToStringComposer() {}
+
+private:
 	void Visit(void*, const Integer& primitive) const;
 	void Visit(void*, const String& primitive) const;
 	void Visit(void*, const Character& primitive) const;
diff --git a/alib2data/src/primitive/PrimitiveToXMLComposer.h b/alib2data/src/primitive/PrimitiveToXMLComposer.h
index 234ebc5acf054bb1fbea71df6a103d3cf0871b65..b7f28d8f782fae5b80c3ea4bed980801e3898486 100644
--- a/alib2data/src/primitive/PrimitiveToXMLComposer.h
+++ b/alib2data/src/primitive/PrimitiveToXMLComposer.h
@@ -26,7 +26,10 @@ namespace primitive {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class PrimitiveToXMLComposer {
+public:
+	PrimitiveToXMLComposer() {}
 
+private:
 	/**
 	 * Prints XML representation of String to the output stream.
 	 * @param string String to print
@@ -53,7 +56,7 @@ class PrimitiveToXMLComposer {
 	void compose(std::deque<sax::Token>& out, unsigned primitive) const;
 	void compose(std::deque<sax::Token>& out, bool primitive) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace primitive */
diff --git a/alib2data/src/primitive/String.h b/alib2data/src/primitive/String.h
index fe84241bc5824772d209fc71045935b770f88072..598966faaafcc116264d5b09750b2ebffd73d9ff 100644
--- a/alib2data/src/primitive/String.h
+++ b/alib2data/src/primitive/String.h
@@ -51,7 +51,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<String>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/primitive/Unsigned.h b/alib2data/src/primitive/Unsigned.h
index faa651f14fa0c2742c458868ac3466f60a123aeb..3589ff0a866d454d160efe92d9349c2720a2ff78 100644
--- a/alib2data/src/primitive/Unsigned.h
+++ b/alib2data/src/primitive/Unsigned.h
@@ -48,7 +48,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<Unsigned>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/RegExpAlphabetGetter.h b/alib2data/src/regexp/RegExpAlphabetGetter.h
index 88cea5e1c10a5e93c58439c0dce6caa9a2b19095..50b5362cf1cfa33e94c565f2812592b96ee5af6f 100644
--- a/alib2data/src/regexp/RegExpAlphabetGetter.h
+++ b/alib2data/src/regexp/RegExpAlphabetGetter.h
@@ -21,6 +21,8 @@ class RegExpAlphabetGetter : public VisitableRegExpBase::const_visitor_type {
 	void Visit(void*, const FormalRegExp& empty) const;
 
 public:
+	RegExpAlphabetGetter() {}
+
 	/**
 	 * Composes string representation of RegExp.
 	 * @param regexp RegExp to print
diff --git a/alib2data/src/regexp/RegExpFromStringParser.h b/alib2data/src/regexp/RegExpFromStringParser.h
index c3554ac87cb59619e0e4ac09b88eb88cc245b343..962595375e020735d9866980199f2cfbfce2a432 100644
--- a/alib2data/src/regexp/RegExpFromStringParser.h
+++ b/alib2data/src/regexp/RegExpFromStringParser.h
@@ -25,6 +25,10 @@ struct stringApi;
 namespace regexp {
 
 class RegExpFromStringParser {
+public:
+	RegExpFromStringParser() {}
+
+private:
 	UnboundedRegExpElement* alternation(std::istream& input) const;
 	UnboundedRegExpElement* alternationCont(std::istream& input, UnboundedRegExpElement* left) const;
 	UnboundedRegExpElement* alternationContCont(std::istream& input, UnboundedRegExpAlternation* left) const;
@@ -41,7 +45,7 @@ class RegExpFromStringParser {
 	RegExp parseRegExp(std::istream& input) const;
 	RegExp parseRegExp(std::istream& input, const std::set<FEATURES>& features) const;
 
-	template<typename T> friend class alib::stringApi;
+	template<typename T> friend struct alib::stringApi;
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/RegExpFromXMLParser.h b/alib2data/src/regexp/RegExpFromXMLParser.h
index ccf05f6ae8e7603b0e20add610762f2b82982d47..dde3fdd037291e514fcaf78df8564b90fa7f154a 100644
--- a/alib2data/src/regexp/RegExpFromXMLParser.h
+++ b/alib2data/src/regexp/RegExpFromXMLParser.h
@@ -29,6 +29,10 @@ namespace regexp {
  * Parser used to get RegExp from XML parsed into list of tokens.
  */
 class RegExpFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	RegExpFromXMLParser() {}
+
+private:
 	void parseAlphabet(std::deque<sax::Token>& input, UnboundedRegExp& regexp) const;
 	void parseAlphabet(std::deque<sax::Token>& input, FormalRegExp& regexp) const;
 
@@ -54,7 +58,7 @@ class RegExpFromXMLParser : public sax::FromXMLParserHelper {
 	UnboundedRegExp parseUnboundedRegExp(std::deque<sax::Token>& input) const;
 	FormalRegExp parseFormalRegExp(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/regexp/RegExpToStringComposer.h b/alib2data/src/regexp/RegExpToStringComposer.h
index 1bcee37647733038dd32dda732d0a8dec81dfbb3..18d4b5c5ccc67dacd4a6ec426c71a2a59514840e 100644
--- a/alib2data/src/regexp/RegExpToStringComposer.h
+++ b/alib2data/src/regexp/RegExpToStringComposer.h
@@ -16,6 +16,10 @@
 namespace regexp {
 
 class RegExpToStringComposer : public VisitableRegExpBase::const_visitor_type, UnboundedRegExpElement::const_visitor_type, FormalRegExpElement::const_visitor_type {
+public:
+	RegExpToStringComposer() {}
+
+private:
 	void Visit(void*, const UnboundedRegExpAlternation& alternation) const;
 	void Visit(void*, const UnboundedRegExpConcatenation& concatenation) const;
 	void Visit(void*, const UnboundedRegExpIteration& iteration) const;
diff --git a/alib2data/src/regexp/RegExpToXMLComposer.h b/alib2data/src/regexp/RegExpToXMLComposer.h
index e544dfb9638d3bc1891f26c104f32ee2be0b01e0..815706e63b6c74330dcc7f9bdfc83d9130cde63e 100644
--- a/alib2data/src/regexp/RegExpToXMLComposer.h
+++ b/alib2data/src/regexp/RegExpToXMLComposer.h
@@ -27,6 +27,10 @@ namespace regexp {
  * This class contains methods to print XML representation of regular expression to the output stream.
  */
 class RegExpToXMLComposer : public UnboundedRegExpElement::const_visitor_type, public FormalRegExpElement::const_visitor_type {
+public:
+	RegExpToXMLComposer() {}
+
+private:
 	void Visit(void*, const UnboundedRegExpAlternation& alternation) const;
 	void Visit(void*, const UnboundedRegExpConcatenation& concatenation) const;
 	void Visit(void*, const UnboundedRegExpIteration& iteration) const;
@@ -60,7 +64,7 @@ class RegExpToXMLComposer : public UnboundedRegExpElement::const_visitor_type, p
 	void compose(std::deque<sax::Token>& out, const UnboundedRegExp& regexp) const;
 	void compose(std::deque<sax::Token>& out, const FormalRegExp& regexp) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExp.h b/alib2data/src/regexp/formal/FormalRegExp.h
index 40dd4fc51b8e13d1a547d5bf21bfb6485bfde335..922111a88e9dcea7058b1727b956405abe874458 100644
--- a/alib2data/src/regexp/formal/FormalRegExp.h
+++ b/alib2data/src/regexp/formal/FormalRegExp.h
@@ -101,7 +101,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<FormalRegExp>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/formal/FormalRegExpAlternation.h b/alib2data/src/regexp/formal/FormalRegExpAlternation.h
index 2d6e1d20d5261dbbe9d7f4e7b618f819b3c4ebf5..f117643e2b52344bdba9fb01d1afaf3e8c448d2b 100644
--- a/alib2data/src/regexp/formal/FormalRegExpAlternation.h
+++ b/alib2data/src/regexp/formal/FormalRegExpAlternation.h
@@ -108,7 +108,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<FormalRegExpAlternation>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/formal/FormalRegExpConcatenation.h b/alib2data/src/regexp/formal/FormalRegExpConcatenation.h
index 16be1ad50cccc92f7596013d00bfe81d4cc8bb12..baf325ebd2a7721e471b283eb61ea5026c4e33c1 100644
--- a/alib2data/src/regexp/formal/FormalRegExpConcatenation.h
+++ b/alib2data/src/regexp/formal/FormalRegExpConcatenation.h
@@ -106,7 +106,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<FormalRegExpConcatenation>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/formal/FormalRegExpEmpty.h b/alib2data/src/regexp/formal/FormalRegExpEmpty.h
index 617a9876b4a33ce0adfac457b9012cbb538cfb33..8d26560db08cb6afa685c7b0227bd4deceef6b49 100644
--- a/alib2data/src/regexp/formal/FormalRegExpEmpty.h
+++ b/alib2data/src/regexp/formal/FormalRegExpEmpty.h
@@ -69,7 +69,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<FormalRegExpEmpty>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/formal/FormalRegExpEpsilon.h b/alib2data/src/regexp/formal/FormalRegExpEpsilon.h
index a4beae2722b8f17b6474294981b7c9843d6964e7..002e7a89322222163d32682e08be57550cc010e2 100644
--- a/alib2data/src/regexp/formal/FormalRegExpEpsilon.h
+++ b/alib2data/src/regexp/formal/FormalRegExpEpsilon.h
@@ -70,7 +70,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<FormalRegExpEpsilon>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/formal/FormalRegExpIteration.h b/alib2data/src/regexp/formal/FormalRegExpIteration.h
index 25ff175a7bf59c3807c8e5e79b6045923b6e2031..ca96128de297cdb3c0ac91a34fc9760cc2d5932f 100644
--- a/alib2data/src/regexp/formal/FormalRegExpIteration.h
+++ b/alib2data/src/regexp/formal/FormalRegExpIteration.h
@@ -101,7 +101,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<FormalRegExpIteration>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/formal/FormalRegExpSymbol.h b/alib2data/src/regexp/formal/FormalRegExpSymbol.h
index bfab54dde60cba8d65eeac4207591fe8c32c0eda..69ac734e3b680ef576b6038aa86697b30f1916a4 100644
--- a/alib2data/src/regexp/formal/FormalRegExpSymbol.h
+++ b/alib2data/src/regexp/formal/FormalRegExpSymbol.h
@@ -86,7 +86,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<FormalRegExpSymbol>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExp.h b/alib2data/src/regexp/unbounded/UnboundedRegExp.h
index c6ccb04384be1c6a904fd3e9942fb89709e1798c..ceed4113faf4c186daabfe2e1cc830dbdc2bb9cf 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExp.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExp.h
@@ -101,7 +101,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnboundedRegExp>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h
index 1e01e6c0f13b0662bdc91d30592340dd4c53bbfb..d1e91d0ef7ee08d7d8acb88975727b45b28c9b07 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h
@@ -102,7 +102,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnboundedRegExpAlternation>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h
index 957bc2fa23b8b4447fbb0b299886eb5cd0faee96..1cbfd61f59de4c50cda6e0c27008ff4e24e6d65a 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h
@@ -101,7 +101,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnboundedRegExpConcatenation>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h
index 37135c3ce55c587c5d0d07ebb4c09372d23e16ba..11cdf4243ec69432e1622b3419f19b1551c4144a 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h
@@ -68,7 +68,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnboundedRegExpEmpty>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h
index 66e8501fffd78e4b5e42930165dd63666ed4abaa..5250a2ce894ac4e30bda3be35328a188c4e1af4c 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h
@@ -69,7 +69,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnboundedRegExpEpsilon>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h
index f24f90720bf7308f7fe3f8572b87a10b8d7ebe97..39636d03c2ad982277dd7783a069c6fc27a87b0b 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h
@@ -100,7 +100,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnboundedRegExpIteration>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h
index 8328d789acce49f674741d760a126e07373c5d1a..f08fe3dace4d0c8b231a652e7f7f2899fa1eeba6 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h
@@ -85,7 +85,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnboundedRegExpSymbol>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/string/CyclicString.cpp b/alib2data/src/string/CyclicString.cpp
index 5161be34bcd5a8dbfadaf47776f32b8d0420fcc1..13f771b5178ad50a0eb03c8cbd526e2358420642 100644
--- a/alib2data/src/string/CyclicString.cpp
+++ b/alib2data/src/string/CyclicString.cpp
@@ -98,7 +98,7 @@ int CyclicString::compare(const LinearString& other) const {
 		return comp(alphabet, other.getAlphabet());
 	}
 
-	if(this->selfTypeId() < typeId<LinearString>())
+	if(this->selfTypeId() < typeId(other))
 		return -1;
 	else
 		return 1;
@@ -118,7 +118,7 @@ int CyclicString::compare(const Epsilon& other) const {
 		return comp(alphabet, other.getAlphabet());
 	}
 
-	if(this->selfTypeId() < typeId<Epsilon>())
+	if(this->selfTypeId() < typeId(other))
 		return -1;
 	else
 		return 1;
diff --git a/alib2data/src/string/CyclicString.h b/alib2data/src/string/CyclicString.h
index 779ec6ab140fc00c11f4fd4404a419fef8ffcec6..e90195188fef9c44833fa63a2c27d71a57d2a908 100644
--- a/alib2data/src/string/CyclicString.h
+++ b/alib2data/src/string/CyclicString.h
@@ -65,7 +65,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<CyclicString>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/string/Epsilon.cpp b/alib2data/src/string/Epsilon.cpp
index 7802c8e54debc3628ba79a5696bd2bf92950c0bc..79f32b2cd6783fd00ba4207c355ec07cba5c7654 100644
--- a/alib2data/src/string/Epsilon.cpp
+++ b/alib2data/src/string/Epsilon.cpp
@@ -45,7 +45,7 @@ int Epsilon::compare(const LinearString& other) const {
 		return comp(alphabet, other.getAlphabet());
 	}
 
-	if(this->selfTypeId() < typeId<LinearString>())
+	if(this->selfTypeId() < typeId(other))
 		return -1;
 	else
 		return 1;
@@ -57,7 +57,7 @@ int Epsilon::compare(const CyclicString& other) const {
 		return comp(alphabet, other.getAlphabet());
 	}
 
-	if(this->selfTypeId() < typeId<CyclicString>())
+	if(this->selfTypeId() < typeId(other))
 		return -1;
 	else
 		return 1;
diff --git a/alib2data/src/string/Epsilon.h b/alib2data/src/string/Epsilon.h
index 305072d4dead6ffd98b466a56ef87e40651b9a7d..69c22ccc62d752aee474450168a5d99b7c8f2690 100644
--- a/alib2data/src/string/Epsilon.h
+++ b/alib2data/src/string/Epsilon.h
@@ -54,7 +54,7 @@ public:
 	static Epsilon EPSILON;
 
 	virtual int selfTypeId() const {
-		return typeId<Epsilon>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/string/LinearString.cpp b/alib2data/src/string/LinearString.cpp
index 85d8d5bd19e8ab19c59a35011e694e1f0c87288e..13baddbb008e79668bb8c12e2a3d7a2689421970 100644
--- a/alib2data/src/string/LinearString.cpp
+++ b/alib2data/src/string/LinearString.cpp
@@ -117,7 +117,7 @@ int LinearString::compare(const CyclicString& other) const {
 		return comp(alphabet, other.getAlphabet());
 	}
 
-	if(this->selfTypeId() < typeId<CyclicString>())
+	if(this->selfTypeId() < typeId(other))
 		return -1;
 	else
 		return 1;
@@ -129,7 +129,7 @@ int LinearString::compare(const Epsilon& other) const {
 		return comp(alphabet, other.getAlphabet());
 	}
 
-	if(this->selfTypeId() < typeId<Epsilon>())
+	if(this->selfTypeId() < typeId(other))
 		return -1;
 	else
 		return 1;
diff --git a/alib2data/src/string/LinearString.h b/alib2data/src/string/LinearString.h
index 208799eef1c983fbfdd320e30664925039a533a6..67712ca6f8b719808a7fd6ca46a11b46504d3942 100644
--- a/alib2data/src/string/LinearString.h
+++ b/alib2data/src/string/LinearString.h
@@ -73,7 +73,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<LinearString>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/string/StringAlphabetGetter.h b/alib2data/src/string/StringAlphabetGetter.h
index ec391dba5e7825998597abfecefb76325368de39..e4ccf3971df16b5249adc4c02d406037de4eca8e 100644
--- a/alib2data/src/string/StringAlphabetGetter.h
+++ b/alib2data/src/string/StringAlphabetGetter.h
@@ -23,6 +23,8 @@ class StringAlphabetGetter : public VisitableStringBase::const_visitor_type {
 	void Visit(void*, const LinearString& empty) const;
 
 public:
+	StringAlphabetGetter() {}
+
 	/**
 	 * Composes string representation of String.
 	 * @param string String to print
diff --git a/alib2data/src/string/StringFromStringParser.h b/alib2data/src/string/StringFromStringParser.h
index 0212a952adcb6fd49e851e649892d3707fb2c432..64654fc0b7e799adec44487497f90b68b4e853b5 100644
--- a/alib2data/src/string/StringFromStringParser.h
+++ b/alib2data/src/string/StringFromStringParser.h
@@ -24,6 +24,10 @@ struct stringApi;
 namespace string {
 
 class StringFromStringParser {
+public:
+	StringFromStringParser() {}
+
+private:
 	std::vector<alphabet::Symbol> parseContent(std::istream&) const;
 
 	StringFromStringLexer m_StringLexer;
@@ -31,7 +35,7 @@ class StringFromStringParser {
 	String parseString(std::istream&) const;
 	String parseString(std::istream&, const std::set<FEATURES>& features) const;
 
-	template<typename T> friend class alib::stringApi;
+	template<typename T> friend struct alib::stringApi;
 };
 
 } /* namespace string */
diff --git a/alib2data/src/string/StringFromXMLParser.h b/alib2data/src/string/StringFromXMLParser.h
index de39d369fd0f71c3341cd56589b77982f0ce4e6e..72dbfd394eb4bebabaa3503ac4d44c3f1d175219 100644
--- a/alib2data/src/string/StringFromXMLParser.h
+++ b/alib2data/src/string/StringFromXMLParser.h
@@ -32,6 +32,10 @@ namespace string {
  * Parser used to get String from XML parsed into list of tokens.
  */
 class StringFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	StringFromXMLParser() {}
+
+private:
 	std::vector<alphabet::Symbol> parseContentData(std::deque<sax::Token>& input) const;
 	std::set<alphabet::Symbol> parseAlphabet(std::deque<sax::Token> &input) const;
 
@@ -42,7 +46,7 @@ class StringFromXMLParser : public sax::FromXMLParserHelper {
 	CyclicString parseCyclicString(std::deque<sax::Token>& input) const;
 	Epsilon parseEpsilon(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/string/StringToStringComposer.h b/alib2data/src/string/StringToStringComposer.h
index ee6e929bcd6c8aa497ef00c0db8f1092693e8bd7..77264e483e42ceb43065eb114cad7b01ee2c9ba0 100644
--- a/alib2data/src/string/StringToStringComposer.h
+++ b/alib2data/src/string/StringToStringComposer.h
@@ -17,6 +17,10 @@ namespace string {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class StringToStringComposer : public VisitableStringBase::const_visitor_type {
+public:
+	StringToStringComposer() {}
+
+private:
 	void Visit(void*, const LinearString& string) const;
 	void Visit(void*, const CyclicString& string) const;
 	void Visit(void*, const Epsilon& string) const;
diff --git a/alib2data/src/string/StringToXMLComposer.h b/alib2data/src/string/StringToXMLComposer.h
index 5ad49d53377baa2009b745e1f220727b580380cc..72857e478a44a3062f9080735d171d3465352e9e 100644
--- a/alib2data/src/string/StringToXMLComposer.h
+++ b/alib2data/src/string/StringToXMLComposer.h
@@ -26,6 +26,10 @@ namespace string {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class StringToXMLComposer {
+public:
+	StringToXMLComposer() {}
+
+private:
 	/**
 	 * Prints XML representation of String to the output stream.
 	 * @param string String to print
@@ -44,7 +48,7 @@ class StringToXMLComposer {
 	void compose(std::deque<sax::Token>& out, const CyclicString& string) const;
 	void compose(std::deque<sax::Token>& out, const Epsilon& string) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace string */
diff --git a/alib2data/src/tree/RankedTree/RankedTree.h b/alib2data/src/tree/RankedTree/RankedTree.h
index 14a93b5ff83aeb827aabf94b8cce5d1ae7187dff..d85db6707ff43ce8580860d90533e8d7a8eee897 100644
--- a/alib2data/src/tree/RankedTree/RankedTree.h
+++ b/alib2data/src/tree/RankedTree/RankedTree.h
@@ -68,7 +68,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<RankedTree>();
+		return typeId(*this);
 	}
 
 	void nicePrint(std::ostream & os = std::cout) const;
diff --git a/alib2data/src/tree/TreeFromXMLParser.h b/alib2data/src/tree/TreeFromXMLParser.h
index a2ace647cd16f36f644ed9a621e1a02d6da80fe3..a3e26eaa110865e9823a6ef0fb8b905ec2800a59 100644
--- a/alib2data/src/tree/TreeFromXMLParser.h
+++ b/alib2data/src/tree/TreeFromXMLParser.h
@@ -32,7 +32,10 @@ namespace tree {
  * Parser used to get tree from XML parsed into list of Tokens.
  */
 class TreeFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	TreeFromXMLParser() {}
 
+private:
 	RankedNode * parseRankedNode(std::deque<sax::Token> &input) const;
 	UnrankedNode * parseUnrankedNode(std::deque<sax::Token> &input) const;
 	std::set<alphabet::RankedSymbol> parseRankedAlphabet(std::deque<sax::Token> &input) const;
@@ -44,7 +47,7 @@ class TreeFromXMLParser : public sax::FromXMLParserHelper {
 	RankedTree parseRankedTree(std::deque<sax::Token>& input) const;
 	UnrankedTree parseUnrankedTree(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/tree/TreeToXMLComposer.h b/alib2data/src/tree/TreeToXMLComposer.h
index df71f10d5461c8917f46f71fa355e876300a3082..512ee8cda277241dde9581b8ffa7f09a8491d218 100644
--- a/alib2data/src/tree/TreeToXMLComposer.h
+++ b/alib2data/src/tree/TreeToXMLComposer.h
@@ -28,7 +28,10 @@ namespace tree {
  * This class contains methods to print XML representation of tree to the output stream.
  */
 class TreeToXMLComposer {
+public:
+	TreeToXMLComposer() {}
 
+private:
 	void composeAlphabet(std::deque<sax::Token>& out, const std::set<alphabet::RankedSymbol>& symbols) const;
 
 	void composeAlphabet(std::deque<sax::Token>& out, const std::set<alphabet::LabeledSymbol>& symbols) const;
@@ -50,7 +53,7 @@ class TreeToXMLComposer {
 
 	void composeNode(std::deque<sax::Token>& out, const UnrankedNode& node) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace tree */
diff --git a/alib2data/src/tree/UnrankedTree/UnrankedTree.h b/alib2data/src/tree/UnrankedTree/UnrankedTree.h
index c4e6392245fb44507160637477c4d594359cc4bf..1fb0e36e13c2217cea8523e5949058cc865b7d24 100644
--- a/alib2data/src/tree/UnrankedTree/UnrankedTree.h
+++ b/alib2data/src/tree/UnrankedTree/UnrankedTree.h
@@ -66,7 +66,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnrankedTree>();
+		return typeId(*this);
 	}
 
 	void nicePrint(std::ostream & os = std::cout) const;
diff --git a/alib2data/test-src/automaton/AutomatonTest.cpp b/alib2data/test-src/automaton/AutomatonTest.cpp
index 76733d8382e24198f443d3a13d33249e9f7fbc3f..8779db68259dc36723605742aa6e96c4c88ef2d3 100644
--- a/alib2data/test-src/automaton/AutomatonTest.cpp
+++ b/alib2data/test-src/automaton/AutomatonTest.cpp
@@ -290,7 +290,7 @@ void AutomatonTest::testNPDATransitions() {
 }
 
 void AutomatonTest::testRHPDATransitions() {
-	automaton::RealTimeHeightDeterministicNPDA automaton(alphabet::Symbol(alphabet::BottomOfTheStackSymbol::BOTTOM_OF_THE_STACK));
+	automaton::RealTimeHeightDeterministicNPDA automaton{alphabet::Symbol(alphabet::BottomOfTheStackSymbol::BOTTOM_OF_THE_STACK)};
 	automaton.setStates({automaton::State(1), automaton::State(2), automaton::State(3)});
 	automaton.setInitialStates({automaton::State(1)});
 
diff --git a/alib2data/test-src/common/VisitorTest.cpp b/alib2data/test-src/common/VisitorTest.cpp
index a59db252bb4f11c9b5fcbdd10ce8db0806192fbf..4b6a6fa3737839610e28a72707534f7d0dd28794 100644
--- a/alib2data/test-src/common/VisitorTest.cpp
+++ b/alib2data/test-src/common/VisitorTest.cpp
@@ -62,7 +62,7 @@ public:
 	}
 
 	virtual int selfTypeId() const {
-		return typeId<Tmp1>();
+		return typeId(*this);
 	}
 
 	int getData() const {
@@ -107,7 +107,7 @@ public:
 	}
 
 	virtual int selfTypeId() const {
-		return typeId<Tmp2>();
+		return typeId(*this);
 	}
 
 	double getData() const {
@@ -156,7 +156,7 @@ public:
 	}
 
 	virtual int selfTypeId() const {
-		return typeId<Tmp3>();
+		return typeId(*this);
 	}
 
 	const std::string& getData() const {