Operator << with virtual classes
<p>i have a problem. I have a class logic, with a string and an object. I want that when i write <code>cout&lt;&lt;a</code> in the logic class, this operator changes my string. So i did this:</p>

<p>logic.h</p>

<pre><code>class logic
{
private:
int str;
A a;
public:
...
};
</code></pre>

<p>logic.cpp</p>

<pre><code>...
...
cout&lt;&lt;*a;
...

ostream&amp; operator&lt;&lt;(ostream&amp; os, const A&amp; A)
{
    int=a.num;
    return os;
}
</code></pre>

<p>z.h</p>

<pre><code>class Z
{
public:
virtual Z* aa();
...
};
</code></pre>

<p>a.h</p>

<pre><code>class A: public Z
{
private:
int num;
public:
virtual Z* aa();
...
};
</code></pre>

<p>And i got these errors:</p>

<blockquote>
  <p>expected class-name before '{' token (<code>on class A:public Z {</code> ) ISO
  C++ forbids declaration of 'Z' with no type, 'Z' declared as a
  'virtual' field, expected ';' before '*' token (on every virtual
  function in A)</p>
</blockquote>

<p>Can you help me?</p>
