I'm not sure what you mean by defining. A macro definition, or something else?
Currently I've done something like this in a node's header.
#include "scene/2d/node_2d.h"
class MyNode : public Node2D {
GDCLASS(MyNode, Node2D);
When I add this node in the Editor it has the white icon of a Node and not Node2D.