It depends on a lot of things, and there is no exact answer, but the following general rules apply in most cases.
Under Article I, section 9 of the Oregon Constitution, a person has a protected privacy or possessory interest in property over which the person has control or the right to control including cars. In a case called State v. Herrin the Oregon Supreme Court said a defendant has a protected privacy interest in a vehicle which the defendant was exercising over control and had the right to control but did not own. In other words, a person borrowing a vehicle has a sufficient possessory interest in such vehicle as to afford the borrower constitutional protections under Article I, section 9. Generally, A search of a car must either be authorized by a judicial warrant or there must be exigent circumstances, other than the mobility of the car, to justify a warrantless search. This is commonly called the Automobile Exception. If the police want to search your car, and it was not moving when the police found it, they must get a warrant. If the car was moving when the police found it and the police have probable cause and exigent circumstances that may be a lawful reason for them to search. Exigent circumstances, in its most basic form, just means that there is some reason to believe that there is an urgent need to search. For example, the loss or destruction of evidence may justify a search. Simply put, police must have probable cause that a crime was committed, probable cause that evidence of that crime is in your car, and must demonstrate a need to search.
There are other exceptions to these rules including searching for evidence of a crime when a person has been arrested while in the car. For example, if a person is arrested for DUII police can search for alcohol containers in the car as evidence of a DUII.
Car searches really depend on the exact facts of your case and you should consult an attorney if you have had your car searched. However, you should never give police consent to a search of your car without first consulting an attorney.