CCNode Removal Help

I have a CCLayer.

I create a CCNode* from another function, return it and add it to the CCLayer.

When I ret to remove it bu tag however I am told it doesn’t exist

cocos2d::CCNode* Class::function() {
cocos2d::CCNode* n = cocos2d::CCNode::create()
… I add stuff to it….
node~~>setTag;
return node;
}
Then elsewhere I do:
mynode = Class::function;
addChild;
and when ready to move:
removeChildByTag;
I am told that the child doesn’t exist
I even tried
mynode = Class::function;
mynode~~>setTag(9);
addChild(mynode, 3);

and when ready to move:

removeChildByTag(9);

I am told that the child doesn’t exist

autorelease() has been invoked in cocos2d::CCNode::create() method, so the node is released automatically at the end of this message loop.

so I would specifically call retain()?

and where do I call that? Can you tell me in the code I posted?