C - C++ Operator Overloading - User Defined Inserter Operator

#include <iostream> 
using namespace std; 
 
class ForgetCodeClass 
{ 
public: 
  int x1, y1, z1;
 
  ForgetCodeClass(int a1, int b1, int c1) { x1 = a1; y1 = b1; z1 = c1; } 
}; 
 
 
// Display X, Y, Z coordinates - ForgetCodeClass inserter. 
ostream &operator<<(ostream &stream, ForgetCodeClass obj) 
{ 
  stream << obj.x1 << ", "; 
  stream << obj.y1 << ", "; 
  stream << obj.z1<< "\n"; 
  return stream;  // return the stream 
} 
 
 
int main() 
{ 
  ForgetCodeClass a(1, 2, 3), b(3, 4, 5), c(5, 6, 7); 
 
  cout << a << b << c; 
 
  return 0; 
}