fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. class City;
  6. class Customer;
  7.  
  8. class Customer {
  9. friend void displayInfo(Customer, City);
  10. private:
  11. int custNum;
  12. int zipCode;
  13. };
  14.  
  15. class City {
  16. friend void displayInfo(Customer, City);
  17. string cityName;
  18. int zipCode;
  19. };
  20.  
  21. void displayInfo(Customer cus, City city) {
  22. cout << cus.custNum; //compiler error - Inaccessible
  23. }
  24.  
  25. int main(){
  26. return 0;
  27. }
Success #stdin #stdout 0s 3452KB
stdin
Standard input is empty
stdout
Standard output is empty