I am making a program with a Cartesian class. I want the user to be able to input 2 coordinates, but when I run it it doesn't ask for any values to be entered. It gives this output
Please enter the first coordinates: Please enter the second coordinates: (4.86129e-270, -1.97785e-41)
(4.86143e-270, -1.97785e-41)

Here is the code
Code:
#include <iostream>
#include <istream>
#include <ostream>


using namespace std;


class Cartesian
{
private:
double x;
double y;
public:
Cartesian( double= 0, double= 0);
friend istream& operator>>(istream&, Cartesian&);
friend ostream& operator<<(ostream&, const Cartesian&);


};


Cartesian::Cartesian(double a, double b)
{
    x=a;
    y=b;
}


istream& operator>>( istream& in, Cartesian& num)
{
    double a, b;
    num.x= a;
    num.y= b;


    in >> a >> b;


return in;
}


ostream& operator<<( ostream& out, const Cartesian& num)
{
    cout << "(" << num.x << ", " << num.y << ")" << endl;


return out;
}


int main()
{
    Cartesian coord1, coord2;
    cout << "Please enter the first coordinates: ";
    cin >> coord1;
    cout << "Please enter the second coordinates: ";
    cin>> coord2;
    cout << coord1;
    cout << coord2;
    
    
    return 0;
}
Also, I want to add a memberwise assignment function to assign the values of coord1 to coord2. How would I go about doing so?