Adding custom variables to the HardwareSerial class?

guix:
There must be a better way!

Well, JarkkoL gave you a code snippet which gave you a starting point based on producing a subclass of HardwareSerial.

I'm still unclear what you aim to achieve with this so I have no idea whether subclassing is a sensible way to achieve it.