Possible Duplicate:
std::endl is of unknown type when overloading operator<<
#include <iostream>
using namespace std;
struct OutputStream
{
template<class T>
OutputStream& operator <<(const T& obj)
{
cout << obj;
return *this;
}
};
OutputStream os;
int main()
{
os << 3.14159 << endl; // Compilation Failure!
}
The VC++ 2012 compiler complains:
error C2676: binary '<<' : 'OutputStream' does not define this operator or a conversion to a type acceptable to the predefined operator