Given the code below, why would I get an error about A's destructor being private? Obviously it is private, but I don't understand why initializing B's A object instance in this way would cause the destructor of A to be called.
Apologies for any typos, I'm recreating the code from memory from a non-networked system and don't have a compiler.
class A
{
    public:
        A(int val) : x(val) {}
    private:
        int x;
        ~A() {}
};
class B
{
    public:
        B() : aInstance() {}
    private:
        A aInstance;
};
int main()
{
    B b;
}
 
     
     
     
     
     
    