Overloaded output operator in base class
<p>I have a number of classes that represent various computer components, each of which have an overloaded <code>&lt;&lt;</code> operator declared as follows:</p>

<pre><code>friend ostream&amp; operator &lt;&lt; (ostream&amp; os, const MotherBoard&amp; mb);
</code></pre>

<p>Each returns an ostream object with a unique stream describing that component, some of which are composed of other components. I decided to create a base class called <code>Component</code> in order to generate a unique id as well as some other functions that all the components will publicly derive. Of course, the overloaded <code>&lt;&lt;</code> operator doesn't work with pointers to <code>Component</code> objects.</p>

<p>I was wondering how I would effect something like a pure virtual function that will be overwritten by each derived class's <code>&lt;&lt;</code> operator so I could do something like:</p>

<pre><code>Component* mobo = new MotherBoard();

cout &lt;&lt; *mobo &lt;&lt; endl;

delete mobo;
</code></pre>
