Of course it's possible - in effect that's what the C/C++ compiler does.
But why in God's name would you want to do this? If it were for educational value, then surely doing the COM stuff by hand in straight C would do the trick.
Given the updated question, I'd suggest that you write the COM stuff in a DLL and inject that DLL into the program you want to patch, then patch in simple x86 code into the program to call your DLL that does the heavy lifting. I don't recall the techniques for injecting a DLL into the address space of a process, but there are at least a couple. The AppInit registry setting (or something like that) is one.
However, I think that most of the avenues for injecting code into a process are considered security flaws (and have often been used by malware), so I suspect that Microsoft may have removed many if not most (or all) from more recent service packs or OS versions.