Setting a pointer to an object, having objects point to each other
<p>I am creating a class called Team. How can I get two objects to point to each other as Partners? Here is what I have been working on thus far. I have tested it with just the boolean data field and I know the rest of my program works so far.</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

 class Team
{
    public:

    Team();
    Team(bool prac, Team *part);
    Team *partner;
    bool practiced;
    void createPairing (Team *t1, Team *t2);
};


Team::Team()
{
    practiced = false;
    partner = 0;
}

Team::Team(bool prac, Team *part)
{
    practiced = prac;
    partner = part;
}

void Team::createPairing (Team *t1, Team *t2)
{
    t1-&gt;partner = t2;
    t2-&gt;partner = t1;
}

int main()
{
    Team Harry;
    Team Ron;
    Team *p1 = &amp;Harry;
    Team *p2 = &amp;Ron;
    Team createPairing(p1, p2);

    cout &lt;&lt; Harry.partner &lt;&lt; endl;
    return 0;
}
</code></pre>
