compare two value in oop based programing

#include<iostream>
using namespace std;
class com
{
private:
    int a;
    int b;
public:
    int d()
    {

        cin>>a;

        return 0;
    }
    int bd()
    {
        cin>>b;


        return 0;
    }

};
int main()
{
    com c1;


    if(c1.d()==c1.bd())
    {
        cout<<"y"<<endl;
    }
    else
    {
        cout<<"n"<<endl;
    }
    return 0;
}

You have c1.d() and c1.bd() BOTH returning zero. Instead you should return the values you read in, return a; or return b;