I guess it depends on the drug. I still got a fair amount of colds as an alcoholic/benzo-addict. I also see a fair amount of crack/methamphetamine addicts who seem rundown and prone to colds/viruses, and I know from personal experience that a stimulant bender substantially cutting into my sleep was a good setup for catching a cold of some kind. That said, stimulants do help ease most of the classic cold symptoms, so I could see a certain "masking" effect.
As for opiate addicts, I hear different things. In my experience as one, I've noticed a definite decline in the number of cold-type events as well as a steep decline in the severity of the few colds I do get. It could be just aging, since I definitely aged out of my sickliest period before that, but I tend to credit the drug (addiction) itself with some of the immunity.
Some people say it masks the symptoms, and I get that, since opiates are incredibly good at easing cold symptoms. But personally, I feel like I know when I am sick and not feeling it much, versus when I have not been sick at all. In any event, the misery of having a cold/etc. is knowing you have it. If it never registers with you, do you really even have one? (In the "tree falls in an empty forest" sense...)