changed toCart() method to public