Yep, the easy way is to put operator<<
inside Bar
:
struct Bar {
Bar ( const T &t ) : otherT_( t ) {}
T otherT_;
friend std::ostream& operator<< ( std::ostream &os, const Bar &bar )
{
os << "<bar: " << bar.otherT_ << ">";
return os;
}
};
I am digging the other way ...