I get the following error:
error: cannot bind 'std::ostream {aka std::basic_ostream<char>}' lvalue to 'std::basic_ostream<char>&&'
cout << *(trn[i]) << endl;
^
I also seem to be getting a compiler error when passing a const Planet& (from an array of Planets) into the ostream.
Thankyou for not telling us what the error message is, and for not showing us all the code we'd need to see to be able to solve the problem. This is so much more fun when we have to play guessing games.
Yes, now that I think about it. All of these examples use the templated class ]ArrayList<T>. trn is an ArrayList<Planet*>, while planets is an ArrayList<Planet>. Both of the lines of code causing errors are returning a Planet&, which I've done by overloading operator [] in my ArrayList class. The only confusing thing is that the Planet class doesn't have any templated objects in it.