I want to do a 45 hour course to obtain a PPL. The course only includes 10 solo hours but states that it is enough to hire light aircraft.
So could I rent a Cessna after this and take a passenger?
Most people do not take 45 hours to get a PPL, the national average is closer to 70. Do not fall for the "get your license in 45 hours" gimicks. They will give you 45 hours of instruction (and you will probably need more), you also then need to book the examiner and pay for that. 45 hours is difficult to do in short periods of time as well, for example I got my license in 47 hours, way below national average, and it took me 7 months (weather/work/instructor availability/aircraft availability/etc).
So theoretically yes, you can, if you are renting from the same place that you took your training. If not, then you will probably have to pass a check-out which will include about half an hour of ground and an hour or so of air with the company renting the aircraft. You may also not be allowed to rent overnight unless you have X number of hours, again this is up to the rental company.
You also need to have insurance which meets the rental company's requirements. Some rental companies won't rent aircraft overnight, so you need to check that, and if they rent for longer periods of time you will end up paying extra even while the aircraft sits on the ground.
For example, a local company will rent one of the 172's for up to 4 days. The regular rental rate is \$125/hr and overnights are charged $375 for each day.
If you just want to be able to take people for rides, just do an NPPL, roughly equivalent to Sport Pilot in the US or Recreational Pilot in Canada/Aus. The privileges of that license cover 95% of the flying that private pilots do anyway, which is flying around VFR during the day alone or with one passenger.
Probably less than half the cost. Those licenses are a bit less than what the 35 hour Private Pilot course was like 43 years ago when I learned to fly, which cost me $1100 1975 dollars or about 5 grand today.