Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include<iostream.h> #include<conio.h> class a { private: int x; int y; public:

ID: 3619209 • Letter: #

Question

#include<iostream.h>
#include<conio.h>
class a
{
    private:
    int x;
    int y;
    public:
    a()
    {
x=0;
y=0;
    }
    friend voidoperator>>(istream&,a);
    friend void operator<<(ostream&,consta);
};
void operator>>(istream &in, a obj)
{
    cout<<" Enter X:";
    in>>obj.x;
    cout<<" Enter Y:";
    in>>obj.y;
}
void operator<<(ostream& os,const a obj)
{
    os<<" X is :"<<obj.x<<" Y is:"<<obj.y;
}
void main()
{
    a object;
    cin>>object;
    cout<<object;
    getche();
}

when i runthis program it gets any integer value from the user but itdisplay
the values of x and y 0.
is there any mistake in the overloaded operators function that isoperator>> and operator<<
or something else.

Explanation / Answer

please rate - thanks #include #include class a { private:     int x;     int y; public:     a()     { x=0; y=0;     }     friend istream&operator>>(istream&,a&);     friend ostream&operator(istream &in, a&obj) {     coutobj.x;     coutobj.y; } ostream &operator