Consider the following code.
Here, A a(B()) compiles even though the constructor is A(B& b);
But print(B()) does not work. But print is also declared as print(B& b);
Why this inconsistency?
#include <iostream>
using namespace std;
class B{
    public:
            char b;
};
class A {
    public:
            B b;
            A(B& b);
            A() { }
};
A::A(B& b) {
    this->b = b;
}
void print(B& b) { }
int main(){
    print(B());
    A a(B());
}
 
     
     
     
     
    