<<操作符重载#include <iostream>#include <string>using namespace std;class myString{ friend ostream& operator <<(ostream&, const myString&);public: myString(const string str = "Hello"): _str(str) { }private: string _str;};ostream& operator << (ostream& os, const myString &ob){ os << ob._str; return os;}int main(){ myString str("world"); cout << str << endl; return 0;}