C++ – Forward Declaration of class in C++, incomplete type

c++

I have an issue with Forward Declaration in C++ using clang compiler. Here is my code. It points data in CReference member as incomplete type.
Please Help

class Internal;

class CReference {
private:
    Internal data;
public:

    CReference () {}    
    ~CReference (){}
};

class Internal {
public:
    Internal () {}
    ~Internal () {}
};

Best Solution

Forward declarations are useful when the compiler does not need the complete definition of the type. In other words, if you change your Internal data; to Internal* data or Internal& data, it will work.

Using Internal data;, the compiler needs to know the whole definition of Internal, to be able to create the structure of CReference class.