My question involves police conduct in the State of: Michigan

I was arrested a few nights ago for possession of marijuana and opium and I just wanted to make sure that the officer involved acted in accordance with the law, so heres my story: I was driving around with two friends, the driver is 17, the person in the passenger seat is older(mid thirties maybe), and I was in the back seat (I am 19). Me and the driver had just picked up the other person (who was drunk) and he brought a beer into the car with him, so we drove across town until we saw a police cruiser. Upon seeing the officer the passenger who had a beer stupidly threw his beer out the window, which the officer saw and pulled us over. He immediately ordered the passenger out of the car, I don't know what was said to the passenger, only that he was searched. After placing the passenger into the squad car the officer ordered the driver out of the car and proceeded to search and Breathalyze him, after finding out he was clean the officer ordered me out, I got out and the officer asked if I had anything illegal on me. At this point I asked the officer "what are my rights in this situation?" he didnt answer me and instead ordered me up against the car and patted me down and found the drugs and asked what the baggie of opium was. I was then breathalyzed and then I was cuffed and placed in the car (he never said I was under arrest or read me my rights or anything) after I was in the squad car he searched my friends car (and never asked to search it) and when he found nothing he took the other person out of the car, wrote him a ticket for littering and let them go. I was then taken to jail and made bond the next morning and I am currently waiting for my arraignment to be scheduled. At no point was I ever told my rights. I have no clue if anything was illegal but I figured I should check it out anyway, sorry the post is so long (I didn't want to leave out anything important) Thanks for reading and please give me your input.
Thanks