Ferguson to retire as Man Utd manager at end of season