Solving cross referencing
<p>I have a problem creating some form of hierarchy with different object types. I have a class which has a member of another class, like this:</p>

<pre><code>class A
{
public:
    A(){}
    ~A(){}

    void addB(B* dep){
        child = dep;
        dep-&gt;addOwner(this);
    }
    void updateChild(){
        child-&gt;printOwner();
    }
    void print(){
        printf("Printing...");
    }
private:
    B* child;
};
</code></pre>

<p>And this is class B:</p>

<pre><code>class B
{
public:
    void addOwner(A* owner){
        ownerObject = owner;
    }

    //ISNT WORKING
    void printOwner(){
        ownerObject-&gt;print();
    }

private:
    A* ownerObject;
};
</code></pre>

<p>Calling a function of "B" out of class "A" works just fine but trying it vice versa gives a compiler error because A is not defined in B. It actually is by using an include and a forward declaration, but I guess its a cross reference problem which the compiler can not solve.</p>

<p>Is there any chance to solve this problem or should I rethink my design?</p>
