how to print class object in c++? I have refine the <<
<p>in class test:</p>

<pre><code>ostream&amp; operator &lt;&lt;(ostream&amp; os, const Test&amp; test){
    os&lt;&lt;"hooooo"&lt;&lt;endl;
    return os;
}
</code></pre>

<p>in test code:</p>

<pre><code>Test t2 = Test(10, 20);
</code></pre>

<p>why <code>cout&lt;&lt; t2 &lt;&lt;endl</code> compile pop error? I have refine the &lt;&lt;.</p>

<p>no match for 'operator&lt;&lt;' in 'std::cout &lt;&lt; t2'</p>
