#include #include using namespace std; class SillyString{ public: SillyString()=default; SillyString(string s):word(s){}; SillyString & operator = (const SillyString & other) { word = other.word; return *this; } SillyString & operator +(const SillyString & other) { SillyString newOne(word + "," + other.word); return newOne; } friend ostream & operator << (ostream & s, const SillyString & other); private: string word; }; ostream & operator << (ostream & s, const SillyString & other){ s << other.word; return s; } int main() { SillyString a("hello"); SillyString b("world"); SillyString c; cout << " a = " << a << " b = " << b << endl; c = a + b; cout << " c = " << c << endl; return 0; }