My draw function returns vector<vector<char>> and I overloaded operator<< but this gives me
no match for ‘operator<<’ (operand types are ‘std::ostream {aka std::basic_ostream<char>}’ and ‘const std::vector<std::vector<char> >’)
AND
cannot bind ‘std::ostream {aka std::basic_ostream<char>}’ lvalue to ‘std::basic_ostream<char>&&’
Note that you are copying each row of the grid while iterating over it. You probably want to turn vec into a reference to avoid creating unnecessary copies.
The following code, based on your description but with Peter87‘s directions, works fine (apart from a couple of warnings referring to unused Rect::draw() parameters):
The problem is: are you sure your code does what you want it to do? For example, why have you declared friend an overloaded operator which doesn’t access private members of your class?