#include<iostream>
using namespace std;
struct A{
    
    int x;
    int y;
    
    A(){
        
    }
    
    A(int a, int b){
        x = a;
        y = b;
    }
};
ostream& operator << (ostream& COUT, A& a){
    COUT<<a.x<<' '<<a.y<<endl;
    return COUT;
}
A operator + (A& a, A& b){
   A temp;
   temp.x = a.x + b.x;
   temp.y = a.y + b.y;
   return temp;
}
int main(){
    A a(12, 15);
    A b(20, 23);
    cout<<a<<b;
    A result = a + b;
    cout<<result;
    return 0;
} 
In this code, if instead of using A operator + (A& a, A& b), I return by reference, it shows an error. Can anyone let me know why can't I return a local variable by reference thank you.
 
    