I was in the car, but the drugs belonged to my friend. Why was I charged with possession of drugs?
This is called "constructive possession." It means that if you are near drugs, and you could exercise control over the drugs, then you are in possession. For example, if four people are in a car inhaling or injecting drugs together and a police officer knocks on the window, all four could be convicted of possession even if the drugs were in the center console and not on anyone person.