The standard header
#include using namespace std;class C{public: friend ostream& operator<<(ostream& os, const C& d); };ostream& operator<<(ostream& os, const C& d);
The declaration of the friend function does not need a complete definition of the ostream class; a forward declaration is sufficient in this case. Therefore,