Well foo is not assignable by design. Let foo have a bar shared pointer, or just bar, if you can avoid the indirection.