No default constructor available when I put a struct in an union, but no errors if it is outside

Solution 1:

A union has default non deleted constructor only if all members of the union have trivial constructors. Same for destructors. Since your struct has a member initializer this means that it doesn't have a trivial constructor this means the union constructor is deleted. You need to create special members for union where you delegate to the active member.

Or better yet use std:: variant which has all this created for you.

As for why it's simple: a union doesn't know which member is active so it cannot call the appropriate constructor/destructor.