fork download
  1. #include <iostream>
  2.  
  3. struct A
  4. {
  5. int a;
  6. int b;
  7. std::string c;
  8.  
  9. friend std::ostream& operator <<(std::ostream& os, A const& a)
  10. {
  11. return os << a.a << '\n'
  12. << a.b << '\n'
  13. << a.c << '\n';
  14. }
  15. };
  16.  
  17. int main()
  18. {
  19. A a = {5, 10, "apple sauce"};
  20.  
  21. std::cout << a;
  22. }
Success #stdin #stdout 0s 3028KB
stdin
Standard input is empty
stdout
5
10
apple sauce