The S&P 500 and the Nasdaq rose on Friday, as Apple gained following a strong sales forecast and a reading of the U.S.