c++ forward referencing
<p>I know this is probably really stupid but how does one do forward reference of inherited classes</p>

<p>Like</p>

<pre><code>class parent
{
...stuff in here
}


class child1 : public parent
{
....
}

class child2 : public parent
{
....
}
</code></pre>

<p>All the classes have to be in the same file and I'm using instances of child2 inside child1 and vice verse. How do I do the forward referencing here? If I just say</p>

<pre><code>class child2;
</code></pre>

<p>at the beginning of the code the compiler does not recognize that it is a subclass of parent when I use it in child1 (and hence the virtual functions don't work). Please help.</p>
