There's only been one person in the history of mankind to have built a C++ compiler single handed, Walter Bright [1]. So I wouldn't even try yourself. He wrote a C compiler, saw a copy of the C++ Annotated Reference Manual, said "how hard can this be?". A couple of years later he'd found out how hard but had a working compiler [2].
If you want the brain bending theory, have a look at the references CPallini gave you. If you want to see how a real compiler works in all it's ugly glory have a look at
g++[
^]. The code is really nasty but will show you the sort of things you have to do to parse C++ - the code generation is actually the easy bit!
And if you're feeling really flush Walter Bright is selling the source for his C++ compiler for
$59[
^] - worth a punt if you're serious.
Anyway, the point here is if you want to modify a C++ compiler to do something it doesn't already do grab g++ and hack on that. If you're trying to research how compilers work and implement a simple one then start with something VERY easy to parse like
this.[
^]
[1] To head this one off at the pass Bjarne Stroustrup wrote Cfront way before Bright wrote Zortech C++. However Stroustrup was implementing a lot simpler language then. By the time the team at AT&T got to the same level as Bright's compiler there were four of them working on it.
[2] This information was from a personal conversation in April 2010 at the ACCU conference during a seminar he gave on compiler design.