Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. class A {
  2. friend std::ostream& operator<<(std::ostream &os, A &a);
  3. };
  4.  
  5. A a() {
  6. return A{};
  7. }
  8.  
  9. int main() {
  10. std::cout << a(); // error!
  11. //A aa = a(); std::cout << aa; // compiles just fine
  12. }
  13.  
  14. error: no match for ‘operator<<’ (operand types are ‘std::ostream {aka std::basic_ostream<char>}’ and ‘A’)
  15. std::cout << a();
  16. ^
  17. ...200 (!) more lines of stderr...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement