Object in the back, visible in the front
The Problem is that the x-ray was checked

when the x-ray is disabled the object in back can't be seen like in the photo and when it is enabled it goes front off everything.

For example the back cube (orange) isn't visible clearly because x-ray isn't checked


But in this photo it is checked look :


this checkbox is used in many things like making/creating/assinging bones without it we could not see the bones:


This Checkbox Can be found here : (Properties panel --> Object --> Display)