#include <iostream>
#include <string>
usingnamespace std;
template <typename T> class Trida;
template <typename T>
ostream& operator<<(ostream & os, Trida<T> &l)
{
os << l.one << endl;
os << l.two << endl;
os << l.number << endl;
return os;
}
template <typename T>
class Trida
{
T one;
T two;
int number;
public:
Trida () {one = "one"; two = "two"; number = 0;}
Trida (T o, T t, int n);
//notice the extra angle brackets right before the parameters!
friend ostream& operator<< <> (ostream & os, Trida<T> &l);
inlinevoid show () const;
};
template <typename T>
Trida<T>::Trida(T o, T t, int n)
{
one = o;
two = t;
number = n;
}
template <typename T>
void Trida<T>::show () const
{
cout << one << endl;
cout << two << endl;
cout << number;
}
int main ()
{
Trida<string> al ("xOne","xTwo",111);
al.show();
cout << al;
system("pause");
return 0;
}