Since the hud layer is attached to your scene, it’ll be affected by CCDirector::sharedDirector()->replaceScene(…);
I’m not sure if Cocos2d-x has a way of ‘replacing scenes’ without affecting particular layers that are attached to it, but what I would try doing is the following:
Remove the HUD layer from the scene.
Replace the scene.
Attach the HUD layer to the new scene.
The very first time creating ‘HUD layer’ I would call ‘retain()’ so that it is not cleaned up by the garbage collector. But make sure to free it yourself to avoid any memory leaks.