cpp: fix problem with circular dependency