// How to overload << to print a self-made class object #include #include #include #include #include class MyClass { double a,b; std::vector v; public: // universal initialization MyClass(double a_,double b_,std::vector v_): a{a_},b{b_},v{v_}{} // overload << for MyClass objects; make << a friend to grant access toprivate data friend std::ostream& operator <<(std::ostream& , const MyClass&); }; std::ostream& operator<<(std::ostream & os, const MyClass& obj) { using namespace std; os<