<p>Is there anyway to declare an object of a class before the class is created in C++?  I ask because I am trying to use two classes, the first needs to have an instance of the second class within it, but the second class also contains an instance of the first class.  I realize that you may think I might get into an infinite loop, but I actually need to create and instance of the second class before the first class.</p>

You can't declare an instance of an undefined class but you can declare a
pointer
to one:
```
```
class A;  // Declare that we have a class A without defining it yet.

class B
{
public:
    A *itemA;
};

class A
{
public:
    B *itemB;
};
```
```