#include<iostream>
using namespace std;
template<class T>
class test;
template<class T>
ostream& operator<<(ostream& os,const test<T>& src);
template<class T>
class test
{
T m;
public:
test(T i):m(i){}
friend ostream& operator<<<>(ostream& os,const test<T>& src);
};
template<class T>
ostream& operator<< (ostream& os,const test<T>& src)
{
os<<"operator<<"<<src.m;
return os;
}
int main()
{
test<int> x(10);
cout<<x<<endl;
return 0;
}
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/akirya/archive/2008/06/04/2509791.aspx