ROOT does this with its own preprocessor and custom comment decorators. like:
class mydata
{
/* simple type */
int n;
/* the following array is of length n */
double * v; //[n]
/* don't serialize the following */
int reference_count; //!
ClassDef(mydata,1) ; // this macro does some magic, 1 is the version number etc.
};