If by compound statement you mean chaining, then you can do that. That's why the ostream is returned rather than just outputing the type in the function.
Code:#include <iostream> using namespace std; class t { public: int i; }; ostream& operator<< (ostream& os,t test) { return os<<test.i; } int main() { t test; test.i=10; t test2; test2.i=20; cout << test << endl <<test2<< endl; return 0; }