How to use class forward declaration?

I am trying to build a 1d array that can take in 2d array as index and return another 2d array with the contend of 1d array:

C1dArray<int> labels = {10,11};
C2dArray<int> index = {{0,1,1,0},{1,0,0,1}};
labels[index] will return {{10,11,11,10},{11,10,1

3 sample files are attached that will implement this functionality. However, in the design, class C2dArray contains an array of class C1dArray.

So class C1dArray has to be declared before class C2dArray. But then C1dArray operator [] method also takes in C2dArray to return C2dArray, example below:

class C1dArray
{
...
};

class C2dArray
{
C1dArray m_rows[];
};

class C1dArray
{
public:
     C2dArray operator[](C2dArray index) { ...}
};

Obviously compiler will complain the C1dArray identifier is already used, so I have to circumvent this problem by using another class to support the functionality I want:

class C1dArray
{
...
};

class C2dArray
{
C1dArray m_rows[];
};

class C1dArraySlice:public C1dArray
{
public:
     C2dArray operator[](C2dArray index) { ...}
};

In this way, I can now use C1dArraySlice to do the fancy indexing I need. However, I wanted this functionality to be in class C1dArray instead of arbitrary create another class C1dArraySlice because in class C2dArray, I have a lot of methods that will return C1dArray that have this functionality too!

Can someone enlighten me how to use forward declaration in MQL4 to solve this problem?