What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
template <class T>
class A {
T_v;
public:
A() {}
A(T v): _v(v){}
friend ostream & operator<<(ostream & c, const A<T> & v);
};
template <class T>
ostream & operator<<(ostream & c, const A<T> & v) { c<<v._v;return c; }
int main()
{
A<int>a(10);
cout<<a<<endl;
return 0;
}
Comments