The best method is to get or make a miter box as others have suggested.
Short of that, the quick carpenter solution for cutting with a circular saw is to use the speed square. The triangular shape includes a 90 and 45 degree angle and there are marks to cut other angles. For the 45, you place the lip of the square against the quarter round, slide the square back until it's the blade is exactly at the mark to cut with the deck of the saw flush against the square, and then you just cut keeping the deck of the saw flush against the square.
For best results:
- Make sure the saw is kept perfectly horizontal with the trim you're cutting.
- Place the square over the part of the wood you intend to keep.
- Clamp the square to the wood if you can't keep a firm grip.
This is more often used for rough cuts, especially with framing. When doing something more accurate like your quarter round, a miter saw or a miter box are the best tools for the job. And for inside corners with quarter round, coping the joint with a coping saw is preferred to a 45 degree cut.
Sample image from makezine.com