When writing unit tests, it is often handy to be able to have access to private data members of an object.
(I know some die-hard unit testers advocate that you should test only via the public interface, but I think a more pragmatic approach makes more sense)
The way I do this is by conditionally disabling the private: keyword when unit testing
#ifndef unitTesting
private:
#endif
and then a build flag in platformio.ini can activate this: build_flags = -D unitTesting
To avoid forgetting to disable this access in normal (production) builds, it would be better if there would be separate build flags for the test builds.
So here is my request for a test_build_flags = -D unitTesting
You should test if the car drives, not if it has an engine inside. You should test behaviour, not inner workings.
If you feel that there is too much magic going on inside, maybe you break the Single Responsibility Principle [SRP]? Then a good idea is to extract some code into a new unit and test that separately.
I mean, instead of looking of workarounds to hack your own code, a bit of refactoring might be a better solution.