Can I overload existing function/operator in existing class?
I was trying to do:
#include #include using namespace std;
You can't add member functions to a class unless you modify that class' definition. Use a free function instead:
string& operator<<(string & lhs, const string & rhs) { return lhs += rhs; }