For anyone getting others to log in for them in another location, be very careful. Niantic is cracking down hard on cheating and spoofing.
Just make sure you leave enough travel time. So if your friend logs out of your account at 3.00pm in another town, don’t log in in your hometown until the time it would take you to get back there, else it will flag up.
So if it takes 40 minutes to get back, wait at least 40 minutes (if not more).