The children are stored in a vector member of the composite: std::vector children;
So this is what the addChild method actually looks like:
void addChild(ComponentPtr child)
child->parent = this;
The unique_ptr is passed by value to show that the ownership of the component is transferred to the composite.
In order for child to be passed in, it has to be copied, which shouldn't compile. unique_ptr is not copy constructible or copy assignable. You're moving out of a temporary unique_ptr instead of the real one.