title: C++ equivalent of Java's toString?
body: <p>I'd like to control what is written to a stream, i.e. <code>cout</code>, for an object of a custom class. Is that possible in C++? In Java you could override the <code>toString()</code> method for similar purpose.</p>