#include <iostream>
#include <string>
using namespace std;
class person {
    string name;
    int age;
    public :
    person() {
        name = "no data found";
        age = 0;
    }
    person(string x, int y) {
        name = x;
        age = y;
    }
    friend void getdata(person);
    friend void printdata(person);
};
void getdata(person x) {
    
    cout<<"Enter name : "<<endl;
    getline(cin, x.name);
    cout<<"Enter age : "<<endl;
    cin>>x.age;
};
void printdata(person x) {
    cout<<"Name : "<<x.name<<endl;
    cout<<"Age : "<<x.age<<endl;
}
int main() {
    person a;
    getdata(a);
    person b("Raj Mishra", 17);
    printdata(a);
    printdata(b);
    return 0;
}
in the above code, even if i enter the values through the getdata(a) function the values in the default constructor show up on the console screen when the printdata(a) function runs.
This is not the case when i create an object using the constructor like when creating the object b. What do i do?
 
    