#include using namespace std; class animal { private: // people don't write private here usually because it's the default for class string name; string type; int age; public: friend ostream& operator<<(ostream& os, animal a); animal(){ // This is a default constructor name = "default name"; type = "default type"; age = 0; } animal(string n, string t, int a){ // this is called a constructor name = n; type = t; age = a; } void get_older(){ age++; } string get_string(){ return name + " " + type + " "; } }; ostream& operator<<(ostream& os, animal a){ return os << a.name << " " << a.type << " " << a.age << " "; } int main(){ animal a("Elsie", "Cat", 14); a.get_older(); a.get_older(); a.get_older(); a.get_older(); cout << a << endl; animal b; cout << b << endl; return 0; }