I'm kinda new to C++ and i got this problem while learning about it
So I have created this class
class A {
    int num;
public:
    //constructor
    A(int num) {
        this->num = num;
    }
    int getNum() {
        return num;
    }
    //overload <<
    friend ostream& operator << (ostream& os,A& a) {
        os << a.getNum();
        return os;
    }
};
In the main function, if I use cout<< A(1); it compiles wrong ( code C2679 in Visual Studio 2017 ).
How can I make it like cout<< int(1); ? Do I need to overload any other operator?
 
     
     
    