How to define class-specific << operator in C++
<p>Given a class such as:</p>

<pre><code>class Person
{
private:
    char *name;

public:
    Person()
    {
        name = new char[20];
    }
    ~Person()
    {
        delete [] name;
    }
}
</code></pre>

<p>I want to print to print the name from an instance of this, using a statement like the following:</p>

<pre><code>cout &lt;&lt; myPerson &lt;&lt; endl;
</code></pre>

<p>What do I need to do to define the <code>&lt;&lt;</code> output operator for this class?</p>
