Your friend is partly right, but it's not that simple. Washing your hair daily can damage it because you're stripping away the natural oils that protect it, and your scalp reacts by producing even more oil to compensate. It's a vicious cycle. That said, if you genuinely have a very oily scalp, you need to find a middle ground instead of leaving it unwashed for weeks.
The ideal approach would be to space out your washes gradually. Start by alternating: wash it one day, then just rinse with water or use dry shampoo the next. Your scalp will take maybe two or three weeks to balance itself out and stop producing so much oil. Some people end up washing every two or three days without any problem once they adapt. If you have a hair type that really needs it more often, that's not the end of the world either, but try to reduce it little by little.
The most important thing is the type of shampoo you use. Ones that are really harsh or contain sulfates speed up that greasy effect. Try something gentler or specifically formulated for oily hair, and use lukewarm water instead of hot because very hot water stimulates the sebaceous glands. It's a matter of experimenting to see what works for your hair specifically.