#include <iostream>
using namespace std;
class Beta;
class Alpha {
public:
Alpha(int x) : data(x) {}
private:
int data;
friend int Sum(Alpha a, Beta b);
};
class Beta {
public:
Beta(int x) : data(x) {}
private:
int data;
friend int Sum(Alpha a, Beta b);
};
int Sum(Alpha a, Beta b) {
return a.data + b.data;
}
int main() {
Alpha a(1);
Beta b(2);
cout << "Alpha + Beta is " << Sum(a, b) << endl;
}
Comments
Leave a comment