Well they were sitting in a car, smoking cannabis. One, it is illegal to consume cannabis, and two, it is illegal to drive under the influence of cannabis. Which your friend was going to clearly do after he was done.

Yes, I believe they had a right to search. They smelled cannabis, which can lead them to believe there may be more inside the vehicle, which again, is illegal. He was in a car, which is illegal to drive under the influence.