Friend Function -1

Using friend function find the maximum number from given two numbers from two
different classes. Write all necessary functions and constructors for the program.




#include<iostream>
using namespace std;
class xyz;
class abc
{
             int a;
public:
            abc(int a1)
            {
                        a=a1;
            }
            void printa()
            {
                        cout<<a<<endl;
            }
            friend void max(abc ,xyz );
};
class xyz
{
             int x;
public:
             xyz(int x1)
            {
                        x=x1;
            }
            void printx()
            {
                        cout<<x<<endl;
            }
            friend void max(abc ,xyz );
};
void max(abc obj1,xyz obj2)
{
           
            if(obj1.a>obj2.x)
                        cout<<"\n Maximum is a"<<obj1.a;
            else
                        cout<<"\n Maximum is x"<<obj2.x;
}
void main()
{
            abc o1(5);
            xyz o2(20);
            o1.printa();
            o2.printx();
            max(o1,o2);
           
}