The brachistochrone problem with frictional forces