How can auto complete be the issue? Could you elaborate? The auto complete does indeed recognize classes correctly.
Because this is the only thing C::B could be blamed on.
And because this is what I've guessed from your vague post.
I thought the exact code is redundant, but here it is. Trying to give "Ally" a "cardname" throws an error during compilation: cardname not declared in this scope.
Sorry but compilation problems are not related to codeblocks, thus they aren't discussed on the codeblocks forums. Check the rules again if you don't believe me. And codeblocks is not a compiler, but an IDE. There is a serious difference between the two kinds of application types. If you understand the difference there is bigger chance to understand and fix your problem.
p.s. And please next time use code tag to wrap code you're pasting here. They make post a bit more tidy.