So what is gravity? A typical definition of gravity is that it is a force. It causes an attraction between two masses. According to this definition, anything that has mass exerts a force. Any object exerts gravity on other objects. It does not matter how small it is, it has gravity. The more matter an object has, the more gravity it has. Your pencil has a tiny bit of gravity, but far too little to notice. What about a planet? It would have a lot of gravity. An objects gravity exerts a pull on other objects. Friction only occurs between objects that are touching. Gravity can act between objects that are not touching. In fact, gravity can act over very long distances. Where else can you feel gravity? 
What factors affect gravity?
Friction between two bodies.