I have a (simplified) static global class and << operator overload as follows:
class Global
{
private:
static int counter;
Global(){};
public:
friend ostream& operator<<(ostream &out, Global &global);
}
ostream& operator<< (ostream &out, Global &global)
{
//... do output
return out;
}
I want to be able to pass a static reference to cout:
cout << Global
However, the << operator wants an instance, yet no instances of this global class actually exist. Is there anyway around this?
Thanks for any help.