fork download
  1. #include <iostream>
  2.  
  3. class SomeClass
  4. {
  5. private:
  6. int m_a;
  7. int m_b;
  8.  
  9. public:
  10. SomeClass(int a, int b) : m_a(a), m_b(b){}
  11. friend std::ostream& operator<<(std::ostream& os, const SomeClass& someClass)
  12. {
  13. os << someClass.m_a << " :: " << someClass.m_b;
  14. return os;
  15. }
  16. };
  17.  
  18. int main()
  19. {
  20. SomeClass someClass(20, 50);
  21.  
  22. std::cout << someClass;
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
20 :: 50