#include <iostream>
using namespace std;
class B;
class A {
private:
int a;
friend void compare(A n1 , B n2);
public:
A (int a){
this->a=a;
cout<<"Number A: "<<a<<"\n";
}
};
class B {
private:
int b;
friend void compare(A n1 , B n2);
public:
B (int b){
this->b=b;
cout<<"Number B: "<<b<<"\n";
}
};
void compare(A n1,B n2) {
if (n1.a==n2.b)
cout<<"\nThe two numbers are equal.";
else
cout<<"\nThe two numbers are not equal.";
}
int main (){
A a(67);
B b(67);
compare(a,b);
return 0;
}
Comments
Leave a comment