If you are simply trying to make the relationship between A and B one of composition, then right-button selection of the blue square at the end of the relationship will bring up a menu, the third item of which allows Composition (solid diamond) or Aggregation (open diamond). You can turn both off with the None option.
This may not solve your variable declarations though. Are you declaring the same attributes in each class, if so this is probably incorrect. A Car, for example, is a composition of CarParts. However, the attributes of aCar may differ from the attributes of it’s composite parts.
-John