title: How to overload operator<< for qDebug
body: <p>I'm trying to create more useful debug messages for my class where store data. My code is looking something like this</p>
  
  <pre><code>#include &lt;QAbstractTableModel&gt;
  #include &lt;QDebug&gt;
  
  /**
    * Model for storing data. 
    */
  class DataModel : public QAbstractTableModel {
      // for debugging purposes
      friend QDebug operator&lt;&lt; (QDebug d, const DataModel &amp;model);
  
      //other stuff
  };
  
  /**
    * Overloading operator for debugging purposes
    */
  QDebug operator&lt;&lt; (QDebug d, const DataModel &amp;model) {
      d &lt;&lt; "Hello world!";
      return d;
  }
  </code></pre>
  
  <p>I expect <code>qDebug() &lt;&lt; model</code> will print "Hello world!". However, there is alway something like "QAbstractTableModel(0x1c7e520)" on the output.</p>
  
  <p>Do you have any idea what's wrong?</p>