Mohit, that is a great question. After a virus invades a person’s body, the virus exists in two distinct circumstances:
1) Some of the virus particles float around in the blood or elsewhere, not yet having invaded a specific cell.
2) Other virus particles have already injected their DNA or RNA into host cells, which is the initial step in hijacking those cells.
Your question is whether the body can fight the virus in both of these circumstances, or only in one of them.
When a virus floats free in the blood, it can (and should) trigger an immune response. Such a response involves white blood cells and antibodies. The white blood cells consist of several distinct types, such as macrophages, T cells, and B cells. All of these components play a role in attacking and destroying the virus. The purpose of immunization is to train the body so that this response can occur much more quickly than it would otherwise.
After the viral DNA or RNA has entered a host cell, the cell itself can sometimes muster a defense that inhibits the action of the invading genetic material. So, to at least some degree, the body can fight back on both battlefields.