Tweaked addChild so that the parent attribute of the child is
automatically modified when invocating this method.