What i did, i think that classB can access to private members of class A.
But i get an error that says that matrix[][] its private or sometimes a differente error, my question is how can i correctly pass an object by reference in this case? i've looked up too many different examples but i still cant get it done.
cb.insert(ca.matrix);
this code can be written as:
1 2
auto temp = ca.matrix;
cb.insert(temp);
Do you see the problem? You are trying to get access to matrix in main(), not class_B.
Actually you never access anything fromm class_A in your class_B::insert()!
To make use of friendship you can do:
1 2 3 4 5 6 7 8
void class_B::insert(&class_A A)
{
A.matrix[10][10]=obj1; //Now you are accessing private member.
}
//...
cb.insert(ca);
//...