title: toString override in C++
body: <p>In Java, when a class overrides <code>.toString()</code> and you do <code>System.out.println()</code> it will use that.</p>
  
  <pre><code>class MyObj {
      public String toString() { return "Hi"; }
  }
  ...
  x = new MyObj();
  System.out.println(x); // prints Hi
  </code></pre>
  
  <p>How can I accomplish that in C++, so that:</p>
  
  <pre><code>Object x = new Object();
  std::cout &lt;&lt; *x &lt;&lt; endl;
  </code></pre>
  
  <p>Will output some meaningful string representation I chose for <code>Object</code>?</p>