Can anybody please tell me what's happening in the following code. I was expecting lvalue error and it will happen if I remove the reference return type of the function. But it's giving me output as 20. Please explain. Thanks.
int &fun()
{
    static int x = 10;
    return x;
}
int main()
{
    fun() = 20;
    cout << fun();
    return 0;
}
 
     
    